{"openapi":"3.0.3","info":{"title":"Planlined API","version":"1.2.0","description":"Planlined API - provides endpoints for case management, document parsing, plan libraries, exports, and third-party integrations.","contact":{"name":"Planlined Support","email":"support@trybart.com"},"x-rateLimit":{"description":"API requests are rate limited to ensure fair usage and system stability.","defaultLimits":{"authenticated":{"requests":100,"window":"1 minute","description":"Standard rate limit for authenticated requests"},"unauthenticated":{"requests":20,"window":"1 minute","description":"Rate limit for unauthenticated requests"}},"headers":{"X-RateLimit-Limit":"Maximum number of requests allowed in the window","X-RateLimit-Remaining":"Number of requests remaining in the current window","X-RateLimit-Reset":"Unix timestamp when the rate limit window resets"},"specialLimits":[{"endpoints":["/api/v1/parse","/api/v1/parse/url","/api/v1/aiparse/*"],"limit":10,"window":"1 minute","reason":"AI and parsing operations are resource-intensive"},{"endpoints":["/api/export/*"],"limit":5,"window":"1 minute","reason":"Export generation requires significant server resources"},{"endpoints":["/api/plan-library/bulk-share"],"limit":10,"window":"1 minute","reason":"Bulk operations are limited to prevent abuse"}],"retryStrategy":"When rate limited, check the Retry-After header or X-RateLimit-Reset header. Implement exponential backoff for retries."},"x-idempotency":{"description":"Idempotency support for safe request retries on mutating endpoints (POST, PUT, PATCH). Requests that supply the header fail closed with 503 when the idempotency store is unavailable.","header":"X-Idempotency-Key","supportedEndpoints":["POST /api/cases/create-with-report","POST /api/cases/create-from-files","POST /api/v1/cases","PUT /api/v1/cases/:id","PATCH /api/v1/cases/:id","POST /api/v1/cases/:caseId/plans","POST /api/v1/cases/:caseId/plans/batch","PUT /api/v1/cases/:caseId/plans/:planId","PATCH /api/v1/cases/:caseId/plans/:planId","POST /api/v1/integrations/benefit-guides","POST /api/v1/integrations/proposal-books/pdf","POST /api/v1/integrations/proposal-books/xlsx","PATCH /api/cases/:id"],"keyRequirements":{"format":"String, max 255 characters. Use UUIDs or meaningful identifiers (e.g., 'case-import-2025-q1').","scope":"Keys are scoped to the authenticated principal, method, and canonical path. Organization-bound credentials also include organization and credential identity.","ttl":"24 hours. After expiration, the same key can be reused."},"responses":{"success":"200/201 with normal response + X-Idempotency-Replayed: true header if cached","conflict":"409 if same key is already processing (concurrent request)","mismatch":"422 if same key was used with a different request body"},"usage":"Include the X-Idempotency-Key header with a unique value when making requests. If the request fails due to network issues, retry with the same key to ensure at-most-once processing."},"termsOfService":"https://trybart.com/legal/terms-of-service.html","license":{"name":"Proprietary","url":"https://trybart.com/license"},"x-logo":{"url":"/assets/branding/planlined-logo.svg","altText":"Planlined Logo"}},"servers":[{"url":"https://app.trybart.com","description":"Production"},{"url":"http://localhost:8080","description":"Local Development (not for production)"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Cases","description":"Case management endpoints for creating, retrieving, updating, and deleting benefit analysis cases"},{"name":"Plan Library","description":"Plan library management for storing and reusing plan templates"},{"name":"Plan Templates","description":"Organization-level plan templates (admin/owner only)"},{"name":"Contribution Templates","description":"Contribution configuration templates"},{"name":"Parse","description":"Document parsing endpoints for extracting benefit data from PDFs and images"},{"name":"Export","description":"Export endpoints for generating PDF, Excel, and Word reports"},{"name":"Location","description":"Location and geocoding utilities"},{"name":"Market Data","description":"Market benchmarks and industry data"},{"name":"Webhooks","description":"Webhook endpoints for third-party integrations (Stripe, Slack, HubSpot, Salesforce)"},{"name":"System","description":"System health and status endpoints"},{"name":"Organizations","description":"Organization and team management endpoints"},{"name":"User","description":"User profile and account management"},{"name":"Subscriptions","description":"Subscription and billing management"},{"name":"Session","description":"Session management and authentication status"},{"name":"Reports","description":"Report generation endpoints"},{"name":"Trial","description":"Trial account management and usage tracking"},{"name":"Plans","description":"Plan CRUD operations (separate from Plan Library)"},{"name":"AI","description":"AI-powered features including plan recommendations and document analysis"},{"name":"Azure","description":"Azure integration and Document Intelligence configuration"},{"name":"Costing","description":"Cost estimation and calculation endpoints"},{"name":"Analytics","description":"User analytics and session tracking"},{"name":"Invitations","description":"Organization invitation management"},{"name":"Web Reports","description":"Shareable web report generation and management. Create public links to benefit reports that can be shared with clients, stakeholders, or embedded in external systems."},{"name":"API Keys","description":"API key management for programmatic access."},{"name":"Assets","description":"Asset upload and retrieval endpoints."},{"name":"Cloud Storage","description":"Cloud storage provider integrations and file operations."},{"name":"Integrations","description":"Third-party integrations and OAuth flows."},{"name":"Feature Flags","description":"Feature flag management and reporting."},{"name":"Realtime","description":"Realtime query/transact operations and health checks."},{"name":"Wizard","description":"Wizard flow utilities and validation endpoints."},{"name":"Analytics","description":"Analytics and reporting endpoints for case metrics and usage statistics."},{"name":"Costing","description":"Cost computation and estimation endpoints for plan analysis."},{"name":"Comparison","description":"Plan comparison and benchmarking endpoints."},{"name":"Bulk Operations","description":"Bulk case and plan operations for batch processing."},{"name":"Webhook Subscriptions","description":"Outbound webhook subscriptions for receiving real-time event notifications"},{"name":"Jobs","description":"Async job status tracking for background operations"},{"name":"Plan Linking","description":"Explicit plan linking for current/renewal/proposed relationships"},{"name":"Error Codes","description":"Error code reference documentation"},{"name":"Authentication","description":"Authentication and authorization endpoints"},{"name":"Email","description":"Email and notification delivery endpoints"},{"name":"Files","description":"File management and download endpoints"},{"name":"Trial Admin","description":"Trial administration and migration endpoints"},{"name":"User Preferences","description":"User profile and preference endpoints"},{"name":"Enrollment Portal","description":"Self-service enrollment sessions and magic-link election forms (v2). Employee-facing flows use a one-time magic-link plus an opaque session token; broker session creation is a back-office endpoint."},{"name":"Election Portal: Admin","description":"Broker-facing session, roster, and invitation management for enrollment forms. Requires bearer or API-key auth."},{"name":"Election Portal: Employee","description":"Employee-facing magic-link workflow: OTP/magic verification, election submission, signatures, attachments."},{"name":"Custom OAuth","description":"Organization-managed OAuth provider connections"},{"name":"External Apps","description":"OAuth access for third-party applications"},{"name":"SBC Links","description":"Short links, signatures, and analytics for SBC documents"},{"name":"Enrollment Batch","description":"Planlined application API"},{"name":"Enrollment Mappings","description":"Planlined application API"},{"name":"Chat","description":"Authenticated chat history"},{"name":"Documents","description":"Document library operations"},{"name":"CMS Marketplace","description":"CMS marketplace and ICHRA data"},{"name":"Element Visibility","description":"User interface visibility rules"},{"name":"Exports","description":"Report and data export jobs"},{"name":"Market","description":"Market benchmarks and Mployer intelligence"},{"name":"File Sharing","description":"Authenticated file sharing"},{"name":"Signatures","description":"Shared-document signatures"},{"name":"Bedrock","description":"AI job status and usage"},{"name":"Legal","description":"Legal acceptance state"},{"name":"RAG","description":"Retrieval-augmented knowledge queries"}],"paths":{"/api/cases/{id}/evidence":{"put":{"operationId":"putCaseEvidence","summary":"Store a case source evidence artifact","description":"Stores content-addressed parse evidence for a case source. Requires cases:write scope. A new case may receive evidence before its first save.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sourceKey","records"],"properties":{"sourceKey":{"type":"string"},"records":{"type":"array","minItems":1,"items":{"type":"object","required":["id","record"],"properties":{"id":{"type":"string"},"record":{"type":"object","required":["keyOrder","fields"],"properties":{"keyOrder":{"type":"array","items":{"type":"string"}},"fields":{"type":"object","additionalProperties":true}},"additionalProperties":true}},"additionalProperties":true}}}}}}},"responses":{"200":{"description":"Evidence artifact stored or reused","content":{"application/json":{"schema":{"type":"object","required":["ok","artifactId","s3Key","bytes","recordCount"],"properties":{"ok":{"type":"boolean","example":true},"artifactId":{"type":"string","pattern":"^[0-9a-f]{64}$"},"s3Key":{"type":"string"},"bytes":{"type":"integer","minimum":0},"recordCount":{"type":"integer","minimum":1}}}}}},"400":{"description":"Invalid case identifier or evidence records"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Organization context required"},"404":{"description":"Case unavailable or cloud storage disabled"},"413":{"description":"Evidence artifact exceeds the size limit"},"500":{"description":"Evidence storage failed"}}}},"/api/cases/{id}/evidence/{artifactId}":{"get":{"operationId":"getCaseEvidence","summary":"Read a case evidence artifact","description":"Reads a content-addressed parse evidence artifact after case access is verified. Requires cases:read scope.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}},{"name":"artifactId","in":"path","required":true,"description":"SHA-256 artifact identifier","schema":{"type":"string","pattern":"^[0-9a-f]{64}$"}}],"responses":{"200":{"description":"Evidence artifact","content":{"application/json":{"schema":{"type":"object","required":["ok","sourceKey","records"],"properties":{"ok":{"type":"boolean","example":true},"sourceKey":{"type":"string"},"records":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"400":{"description":"Invalid case or artifact identifier"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Organization context required"},"404":{"description":"Case or artifact not found"},"422":{"description":"Evidence artifact failed integrity or contract validation"},"500":{"description":"Evidence retrieval failed"}}}},"/api/feature-flags/reconcile":{"post":{"operationId":"reconcileFeatureFlagPublication","summary":"Retry feature flag runtime publication","description":"Admin only. Refreshes the runtime flag cache without replaying database mutations or registering defaults.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Publication state","content":{"application/json":{"schema":{"type":"object","required":["success","publication"],"properties":{"success":{"type":"boolean","example":true},"publication":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["current","pending"]},"retry":{"type":"string"}}},"warning":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"503":{"description":"Database or runtime cache unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/api/feature-flags/retired":{"get":{"operationId":"listRetiredFeatureFlags","summary":"List retired feature flags","description":"Admin only. Returns a paginated, searchable durable retirement register.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}},{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Retired flags and pagination","content":{"application/json":{"schema":{"type":"object","required":["success","flags","pagination"],"properties":{"success":{"type":"boolean","example":true},"flags":{"type":"array","items":{"type":"object","additionalProperties":true}},"pagination":{"type":"object","required":["total","limit","offset","hasMore"],"properties":{"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"hasMore":{"type":"boolean"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"500":{"description":"Failed to load retired flags","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/api/feature-flags/retired/{flagId}":{"get":{"operationId":"getRetiredFeatureFlag","summary":"Get a retired feature flag archive","description":"Admin only. Returns the complete durable archive row for a retired flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"description":"External flag identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Retired flag archive","content":{"application/json":{"schema":{"type":"object","required":["success","archive"],"properties":{"success":{"type":"boolean","example":true},"archive":{"type":"object","additionalProperties":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Retired flag not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"500":{"description":"Failed to load retired flag","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"503":{"description":"Database unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/api/v1/integrations/capabilities":{"get":{"operationId":"getIntegrationCapabilities","summary":"List supported integration workflows","tags":["Integrations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Capability manifest","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationCapabilitiesResponse"},"examples":{"response":{"summary":"Capabilities manifest","value":{"ok":true,"version":"v1","workflows":{"parse":{"endpoint":"/api/v1/parse/unified","authScope":"cases:import"},"caseImport":{"endpoint":"/api/cases/create-from-files","authScope":"cases:write","parserMode":"registry-backed-case-ingestion","sourceDocumentRecovery":"/api/cases/reprocess-source-document/{documentId}"},"benefitGuide":{"endpoint":"/api/v1/integrations/benefit-guides","authScope":"exports:write"},"proposalBookPdf":{"endpoint":"/api/v1/integrations/proposal-books/pdf","authScope":"exports:write"},"proposalBookXlsx":{"endpoint":"/api/v1/integrations/proposal-books/xlsx","authScope":"exports:write"}},"rendering":{"mode":"artifact-input","note":"Provide rendered Benefit Guide HTML or Proposal Book HTML/report data. Case-only rendering is not yet a server capability."}}}}}}},"403":{"description":"Credential has no integration read or export scope"}}}},"/api/v1/integrations/benefit-guides":{"post":{"operationId":"publishBenefitGuideV2","summary":"Publish a hosted Benefit Guide V2","description":"Publishes complete rendered Benefit Guide HTML, injects guide interactions, and returns a share link. A caseId alone cannot be rendered server-side yet.","tags":["Integrations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["html"],"properties":{"caseId":{"type":"string"},"html":{"type":"string","description":"Complete HTML document with closing body tag","maxLength":8000000},"title":{"type":"string"},"themeId":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"customSlug":{"type":"string"},"vm":{"type":"object"}}},"examples":{"request":{"summary":"Publish a benefit guide","value":{"caseId":"case_abc123","html":"<html><body><h1>Benefit Guide</h1>...</body></html>","title":"Acme Corp 2025 Benefit Guide","themeId":"default","customSlug":"acme-2025"}}}}}},"responses":{"201":{"description":"Published guide","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenefitGuidePublishResponse"}}}},"400":{"description":"Invalid rendered guide"},"503":{"description":"Guide service unavailable"}}}},"/api/v1/integrations/proposal-books/pdf":{"post":{"operationId":"exportProposalBookPdf","summary":"Export a rendered Proposal Book PDF","description":"Creates a real PDF from rendered Proposal Book HTML; it does not queue a placeholder job.","tags":["Integrations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["html"],"properties":{"caseId":{"type":"string"},"html":{"type":"string","maxLength":8000000},"filename":{"type":"string"},"options":{"type":"object"}}},"examples":{"request":{"summary":"Generate proposal book PDF","value":{"caseId":"case_abc123","html":"<html><body><h1>Proposal Book</h1>...</body></html>","filename":"acme-proposal-book.pdf","options":{"landscape":false,"printBackground":true}}}}}}},"responses":{"200":{"description":"PDF file","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"503":{"description":"PDF generator unavailable"}}}},"/api/v1/integrations/proposal-books/xlsx":{"post":{"operationId":"exportProposalBookXlsx","summary":"Export a Proposal Book workbook","description":"Creates a real XLSX workbook from the Proposal Book report-data model.","tags":["Integrations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reportData"],"properties":{"caseId":{"type":"string"},"reportData":{"type":"object"},"filename":{"type":"string"},"options":{"type":"object"}}},"examples":{"request":{"summary":"Generate proposal book workbook","value":{"caseId":"case_abc123","reportData":{"plans":[{"name":"Regence HDHP 3000","carrier":"Regence","monthlyPremium":450,"deductible":3000}],"employer":{"name":"Acme Corp","employees":42}},"filename":"acme-proposal-book.xlsx"}}}}}},"responses":{"200":{"description":"XLSX file","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}}},"503":{"description":"Excel generator unavailable"}}}},"/api/v1/integrations/artifacts/{documentId}/download":{"get":{"operationId":"downloadIntegrationArtifact","summary":"Download a versioned integration artifact","description":"Authenticated handoff used by idempotent Proposal Book export retries. Returns a short-lived redirect to the artifact.","tags":["Integrations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"302":{"description":"Redirect to a short-lived signed S3 URL for the artifact","headers":{"Location":{"description":"Signed download URL","schema":{"type":"string","format":"uri"}}}},"403":{"description":"Artifact access forbidden"},"404":{"description":"Artifact not found"}}}},"/api/cases/reprocess-source-document/{documentId}":{"post":{"operationId":"reprocessExternalSourceDocument","summary":"Reprocess a retained external source document","description":"Runs a previously retained source document through the registry-backed external case parser and returns current parse results.","tags":["Cases","Parse"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"forceAI":{"type":"boolean"},"documentTypeHint":{"type":"string","enum":["sbc","quote","rates","invoice","renewal","level-funded","self-funded","self-insured","peo","not-specified"]},"benefitType":{"type":"string","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]}}},"examples":{"request":{"summary":"Reprocess with AI hint","value":{"forceAI":true,"documentTypeHint":"renewal","benefitType":"medical"}}}}}},"responses":{"200":{"description":"Current parse result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"documentId":{"type":"string"},"linkedCaseId":{"type":"string","nullable":true},"pipeline":{"type":"string"},"message":{"type":"string"}}},"examples":{"response":{"summary":"Reprocess result","value":{"ok":true,"documentId":"doc_001","linkedCaseId":"case_001","pipeline":"ai-bedrock","message":"Successfully parsed 3 plans"}}}}}},"403":{"description":"Source document access forbidden"},"404":{"description":"Source document not found"},"422":{"description":"No parser produced plans"}}}},"/api/v1/parse/unified":{"post":{"summary":"Unified document parsing","description":"Parse a document using the unified parser registry with cascading fallback (including AI). Supports async mode for large files. Max file size 50MB; auto-async triggers at 1MB to avoid timeouts. Integration credentials require cases:import, pdf:extract, or cases:write.","tags":["Parse"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF/DOCX/PNG/JPEG"},"forceParser":{"type":"string","description":"Force a specific parser ID (see /api/v1/parse/unified/parsers).","enum":["adp-totalsource","hris-paychex","aura-paychex","aetna-afa","benefit-guide","benefitter","uhc-quote","pdf-invoice","document-parser-sbc","ai-bedrock"]},"documentTypeHint":{"type":"string","description":"Hint to influence parser selection","enum":["sbc","quote","rates","invoice","renewal","level-funded","self-funded","self-insured","peo","not-specified"]},"benefitType":{"type":"string","description":"Benefit type, e.g. medical/dental/vision","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]},"maxAttempts":{"type":"integer","description":"Max parsers to try","default":5,"minimum":1},"async":{"type":"boolean","description":"Force async processing"},"autoAsync":{"type":"boolean","description":"Auto-async for large files (>5MB)"}}}}}},"responses":{"200":{"description":"Synchronous parse result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"plans":{"type":"array","items":{"type":"object","description":"Parsed plan payload. Includes metadata flags: _unifiedPipeline, _parseSource, _serverParsed.","additionalProperties":true,"properties":{"_unifiedPipeline":{"type":"boolean","description":"True when produced by unified parser."},"_parseSource":{"type":"string","description":"Parser ID that produced this plan."},"_serverParsed":{"type":"boolean","description":"Indicates server-side parse."}}}},"source":{"type":"string"},"confidence":{"type":"number"},"attempts":{"type":"array","items":{"type":"object"}},"totalTimeMs":{"type":"integer"},"requestId":{"type":"string"}}},"examples":{"success":{"summary":"Parsed plans","value":{"ok":true,"source":"adp-totalsource","confidence":0.86,"totalTimeMs":2145,"requestId":"unified-1712345678-abcd1","attempts":[{"parserId":"adp-totalsource","success":true,"planCount":2,"timeMs":1800}],"plans":[{"planName":"ADP Gold PPO","benefits":{"deductible":"$1,500 / $3,000","oop":"$6,000 / $12,000"},"_unifiedPipeline":true,"_parseSource":"adp-totalsource","_serverParsed":true}]}}}}}},"202":{"description":"Job queued for async processing","headers":{"Location":{"description":"Canonical job status resource.","schema":{"type":"string"}},"Retry-After":{"description":"Recommended seconds before polling.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncJobSubmission"},"examples":{"queued":{"summary":"Async job queued","value":{"ok":true,"async":true,"jobId":"uparse_1712345678_ab12cd34ef","jobType":"unified_parse","status":"queued","jobUrl":"/api/v1/jobs/uparse_1712345678_ab12cd34ef","resultUrl":"/api/v1/jobs/uparse_1712345678_ab12cd34ef/result","cancelUrl":"/api/v1/jobs/uparse_1712345678_ab12cd34ef","pollUrl":"/api/v1/parse/unified/jobs/uparse_1712345678_ab12cd34ef","requestId":"unified-1712345678-abcd1","links":{"self":"/api/v1/jobs/uparse_1712345678_ab12cd34ef","result":"/api/v1/jobs/uparse_1712345678_ab12cd34ef/result","cancel":"/api/v1/jobs/uparse_1712345678_ab12cd34ef"}}}}}}},"400":{"description":"Missing file or invalid parameters","content":{"application/json":{"examples":{"missingFile":{"summary":"No file provided","value":{"ok":false,"error":"No file provided","requestId":"unified-1712345678-abcd1"}},"unknownParser":{"summary":"Force parser not recognized","value":{"ok":false,"error":"Unknown parser: custom-parser","availableParsers":["adp-totalsource","hris-paychex","aura-paychex","aetna-afa","benefit-guide","benefitter","uhc-quote","pdf-invoice","document-parser-sbc","ai-bedrock"],"requestId":"unified-1712345678-abcd2"}},"tooLarge":{"summary":"File exceeds 50MB limit","value":{"ok":false,"error":"File too large (max 50MB)","requestId":"unified-1712345678-abcd3"}}}}}},"401":{"description":"Unauthorized"},"500":{"description":"Server error","content":{"application/json":{"examples":{"queueFailure":{"summary":"Async queue failure","value":{"ok":false,"error":"queue_failed","message":"Failed to queue async job. Try sync mode instead.","requestId":"unified-1712345678-abcd4"}}}}}}},"operationId":"postApiV1ParseUnified"}},"/api/v1/parse/unified/jobs/{jobId}":{"get":{"summary":"Get unified parse job status","description":"Poll an async unified parse job for status or results.","tags":["Parse","Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"},"description":"Job ID returned by async unified parse","example":"uparse_1712345678_ab12cd34ef"}],"responses":{"200":{"description":"Job status/result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"jobId":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","failed"]},"plans":{"type":"array","items":{"type":"object","description":"Parsed plan payload. Includes metadata flags: _unifiedPipeline, _parseSource, _serverParsed, _asyncProcessed.","additionalProperties":true,"properties":{"_unifiedPipeline":{"type":"boolean","description":"True when produced by unified parser."},"_parseSource":{"type":"string","description":"Parser ID that produced this plan."},"_serverParsed":{"type":"boolean","description":"Indicates server-side parse."},"_asyncProcessed":{"type":"boolean","description":"Indicates async processing."}}}},"source":{"type":"string"},"confidence":{"type":"number"},"error":{"type":"string"},"retryAfter":{"type":"integer"}}},"examples":{"completed":{"summary":"Completed job","value":{"ok":true,"jobId":"uparse_1712345678_ab12cd34ef","status":"completed","plans":[{"planName":"Renewal PPO","benefits":{"deductible":"$2,000 / $4,000"},"_unifiedPipeline":true,"_parseSource":"ai-bedrock","_serverParsed":true,"_asyncProcessed":true}],"source":"ai-bedrock","confidence":0.42}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Job not found","content":{"application/json":{"examples":{"missingJob":{"summary":"No job with that ID","value":{"ok":false,"error":"job_not_found","jobId":"uparse_missing","status":"failed"}}}}}}},"operationId":"getApiV1ParseUnifiedJobsByJobid"}},"/api/v1/parse/unified/parsers":{"get":{"summary":"List unified parsers","description":"Returns available parsers and stats from the unified registry.","tags":["Parse"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Parsers list","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"parsers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"stats":{"type":"object"}}}}}},"example":{"ok":true,"parsers":[{"id":"ai-bedrock","name":"AI Bedrock Parser","enabled":true}]}}}},"401":{"description":"Unauthorized"}},"operationId":"getApiV1ParseUnifiedParsers"}},"/api/cases":{"get":{"summary":"List cases","description":"Returns a paginated list of cases for the authenticated user, including cases shared via organization membership.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","description":"Maximum number of cases to return (1-500)","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}},{"name":"offset","in":"query","description":"Number of cases to skip for pagination","schema":{"type":"integer","minimum":0,"default":0}},{"name":"tag","in":"query","description":"Filter cases by tag","schema":{"type":"string"}}],"responses":{"200":{"description":"List of cases","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Whether the operation succeeded"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CaseMeta"},"description":"Array of items"}},"required":["ok","items"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"items":[{"id":"case-acme-2025","userId":"user_abc123","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","blobPath":"cases/user_abc123/case-acme-2025.json","planHash":"a1b2c3d4e5f6","createdAt":"2025-01-15T10:30:00Z","updatedAt":"2025-01-15T14:45:00Z","updatedAtMs":1705326300000,"tags":["renewal","medical"],"orgId":"org_xyz789","sharedOrgIds":[]},{"id":"case-widgets-2025","userId":"user_abc123","employerName":"Widgets Inc","policyPeriod":"03/01/2025 - 02/28/2026","blobPath":"cases/user_abc123/case-widgets-2025.json","planHash":"b2c3d4e5f6g7","createdAt":"2025-01-10T09:00:00Z","updatedAt":"2025-01-12T16:30:00Z","updatedAtMs":1705077000000,"tags":["new-business"],"orgId":null,"sharedOrgIds":[]}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Database not configured"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCases","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases?limit=20&offset=0\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Content-Type: application/json\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases?limit=20', {\n  headers: {\n    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',\n    'Content-Type': 'application/json'\n  }\n});\nconst data = await response.json();\nconsole.log(data.items);"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},\n    params={'limit': 20, 'offset': 0}\n)\ncases = response.json()['items']"}]},"post":{"summary":"Create or update a case","description":"Creates a new case or fully replaces an existing case document. Send every field that must survive an update; partners should GET first, merge changes, and send the returned row-version ETag in If-Match. The documented setup fields round-trip the Step 1 case state. Organization profiles, asset uploads, source-document uploads, sharing, and notifications remain separate workflows. Stale writes return 412 and missing preconditions return 428.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"If-Match","in":"header","required":false,"description":"Quoted row-version ETag required when replacing an existing case.","schema":{"type":"string","example":"\"4\""}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreateRequest"},"examples":{"fullCase":{"summary":"Complete case with medical (4-tier), dental, vision, and life","value":{"id":"case-acme-corp-2025","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","planData":{"medical":[{"id":"current-medical-1","type":"current","benefitType":"medical","planName":"Current PPO Gold","carrier":"Aetna","rateStructure":"composite","policyNumber":"POL-12345","groupNumber":"GRP-67890","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650},"employeeSpouse":{"enrolled":20,"rate":1200},"employeeChildren":{"enrolled":15,"rate":1100},"family":{"enrolled":30,"rate":1800}},"benefits":{"deductible":{"value":"$1,500 / $3,000"},"oop":{"value":"$6,000 / $12,000"},"coinsurance":{"value":"20%"},"pcp":{"value":"$25"},"specialist":{"value":"$50"},"er":{"value":"$250"},"urgent":{"value":"$75"},"rx-card":{"value":"$10 / $35 / $70"}}}],"dental":[{"id":"current-dental-1","type":"current","benefitType":"dental","planName":"Dental PPO","carrier":"Delta Dental","rateStructure":"composite","enrollmentAndRates":{"employee":{"enrolled":45,"rate":35},"employeeSpouse":{"enrolled":18,"rate":65},"employeeChildren":{"enrolled":12,"rate":60},"family":{"enrolled":25,"rate":95}},"benefits":{"dental-annual-max":{"value":"$1,500"},"dental-deductible":{"value":"$50 / $150"},"dental-preventive":{"value":"100%"},"dental-basic":{"value":"80%"},"dental-major":{"value":"50%"},"dental-ortho":{"value":"50%"},"dental-ortho-max":{"value":"$1,500"}}}],"vision":[{"id":"current-vision-1","type":"current","benefitType":"vision","planName":"Vision Plus","carrier":"VSP","rateStructure":"composite","enrollmentAndRates":{"employee":{"enrolled":40,"rate":8},"family":{"enrolled":35,"rate":22}},"benefits":{"vision-exam":{"value":"$10"},"vision-exam-frequency":{"value":"12 months"},"vision-frames":{"value":"$150"},"vision-frames-frequency":{"value":"24 months"},"vision-contacts":{"value":"$150"}}}],"life":[{"id":"current-life-1","type":"current","benefitType":"life","planName":"Basic Life & AD&D","carrier":"Lincoln Financial","rateStructure":"volume","volumeConfig":{"numberOfCovered":115,"volumeAmount":5750000,"maxBenefit":100000,"ratePerUnit":0.15,"rateLabel":"per $1,000","rateDivisor":1000,"adnd":true},"benefits":{"life-benefit-multiple":{"value":"1x salary"},"life-gi-amount":{"value":"$50,000"},"life-max-benefit":{"value":"$100,000"},"life-ad-d":{"value":"Included"}}}]},"enrollmentTiers":[{"id":"employee","label":"Employee Only"},{"id":"employeeSpouse","label":"Employee + Spouse"},{"id":"employeeChildren","label":"Employee + Child(ren)"},{"id":"family","label":"Family"}],"contributionSettings":{"isEnabled":true,"frequency":24,"modelType":"tiered","models":{"global":{"employee":{"type":"%","value":100},"employeeSpouse":{"type":"%","value":75},"employeeChildren":{"type":"%","value":75},"family":{"type":"%","value":75}}}}}},"ageRatedCase":{"summary":"Age-rated medical plan with member-level data","value":{"id":"case-age-rated-2025","employerName":"Age-Rated Corp","policyPeriod":"01/01/2025 - 12/31/2025","planData":{"medical":[{"id":"current-medical-ar","type":"current","benefitType":"medical","planName":"Age-Rated PPO","carrier":"Blue Cross","rateStructure":"age-rated","members":[{"memberId":"M001","age":32,"relationship":"employee","rate":385.5},{"memberId":"M002","age":45,"relationship":"employee","rate":525},{"memberId":"M003","age":28,"relationship":"employee","rate":345},{"memberId":"M004","age":8,"relationship":"child","subscriberId":"M001","rate":185}],"benefits":{"deductible":{"value":"$2,000 / $4,000"},"oop":{"value":"$7,000 / $14,000"}}}]}}}}}}},"responses":{"200":{"description":"Case saved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Whether the operation succeeded"},"meta":{"$ref":"#/components/schemas/CaseMeta"}},"required":["ok","meta"]},"examples":{"success":{"value":{"ok":true,"meta":{"id":"case-acme-2025","userId":"user_abc123","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","createdAt":"2025-01-15T10:30:00Z","updatedAt":"2025-01-15T10:30:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid payload"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Feature disabled or quota exceeded"},"412":{"description":"The supplied case row version is stale"},"413":{"description":"Case payload too large (max 50MiB of UTF-8 JSON)"},"428":{"description":"An existing case requires If-Match or rowVersion"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Case save failed"}},"operationId":"postCases","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"employerName\": \"Acme Corporation\",\n    \"policyPeriod\": \"01/01/2025 - 12/31/2025\"\n  }'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    employerName: 'Acme Corporation',\n    policyPeriod: '01/01/2025 - 12/31/2025'\n  })\n});\nconst newCase = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},\n    json={\n        'employerName': 'Acme Corporation',\n        'policyPeriod': '01/01/2025 - 12/31/2025'\n    }\n)\nnew_case = response.json()"}]}},"/api/cases/status":{"get":{"summary":"Get cases service status","description":"Returns the status of the cases service including database and storage connectivity.","tags":["Cases","System"],"security":[],"responses":{"200":{"description":"Service status","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether this is enabled"},"backend":{"type":"string","description":"Backend type"},"db":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"storage":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"kind":{"type":"string","description":"Storage type"}}}}},"examples":{"success":{"value":{"enabled":true,"db":{"ok":true},"storage":{"ok":true}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getCasesStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/search":{"get":{"summary":"Search cases","description":"Search cases by employer name or policy period.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"q","in":"query","description":"Search query (matches employer name or policy period)","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CaseMeta"},"description":"Array of items"},"total":{"type":"integer","description":"Total number"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"items":[{"id":"case-acme-2025","userId":"user_abc123","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","tags":["renewal"],"createdAt":"2025-01-15T10:30:00Z","updatedAt":"2025-01-15T14:45:00Z"}],"total":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesSearch","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/search\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/search', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/search',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/{id}":{"get":{"summary":"Get case by ID","description":"Retrieves the full case JSON including all plan data, benefits, enrollment, and contribution settings.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Full case data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"case":{"$ref":"#/components/schemas/CaseData"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"case":{"id":"case-acme-2025","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","planData":{"medical":[{"id":"med-current-1","type":"current","benefitType":"medical","planName":"PPO Gold","carrier":"Aetna","rateStructure":"composite","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650},"family":{"enrolled":30,"rate":1800}},"benefits":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"}}}]},"enrollmentTiers":[{"id":"employee","label":"Employee Only"},{"id":"family","label":"Family"}],"contributionSettings":{"isEnabled":true,"frequency":24,"modelType":"tiered","models":{"global":{"employee":{"type":"%","value":75}}}}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/case-123\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const caseId = 'case-123';\nconst response = await fetch(`https://app.trybart.com/api/cases/${caseId}`, {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst caseData = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\ncase_id = 'case-123'\nresponse = requests.get(\n    f'https://app.trybart.com/api/cases/{case_id}',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ncase_data = response.json()"}]},"patch":{"summary":"Update case metadata","description":"Updates case metadata (employerName, policyPeriod) without replacing the full case blob. Supports optimistic locking via If-Match header.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"If-Match","in":"header","required":true,"description":"Quoted row-version ETag from the previous response.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"employerName":{"type":"string","maxLength":255},"policyPeriod":{"type":"string","maxLength":100}}},"examples":{"default":{"summary":"Example request","value":{"employerName":"Acme Corporation Updated","policyPeriod":"01/01/2025 - 12/31/2025"}}}}}},"responses":{"200":{"description":"Case metadata updated","headers":{"ETag":{"description":"Quoted row version for optimistic locking","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}},"content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"meta":{"$ref":"#/components/schemas/CaseMeta"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"412":{"description":"Precondition failed - ETag mismatch"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"patchCasesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PATCH \"https://app.trybart.com/api/cases/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"If-Match: \\\"7\\\"\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"employerName\":\"Updated Name\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID', {\n  method: 'PATCH',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'If-Match': '\"7\"',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"employerName\":\"Updated Name\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.patch(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN', 'If-Match': '\"7\"'},\n    json={\"employerName\":\"Updated Name\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete case","description":"Permanently deletes a case and its associated blob storage file.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"If-Match","in":"header","required":true,"description":"Quoted row-version ETag of the case being deleted.","schema":{"type":"string","example":"\"4\""}}],"responses":{"200":{"description":"Case deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deleteCasesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/cases/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/{caseId}/reconciliation-restore":{"get":{"summary":"Get saved reconciliation restore payload","description":"Returns the latest saved reconciliation session payload for a case so the broker can reopen the reconciliation flow later.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Saved reconciliation restore payload","content":{"application/json":{"schema":{"type":"object","required":["success","payload"],"properties":{"success":{"type":"boolean","example":true},"payload":{"type":"object","additionalProperties":true,"description":"Opaque reconciliation session payload used to resume the workflow."}}},"examples":{"success":{"summary":"Restore payload found","value":{"success":true,"payload":{"invoice":{"filename":"acme-june-invoice.pdf"},"census":{"filename":"acme-census.xlsx"},"relinks":[],"corrections":{"m_42":{"status":"accepted"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case or restore payload not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"No restore data"}}}}}},"500":{"description":"Failed to read reconciliation restore data"}},"operationId":"getCasesByCaseIdReconciliationRestore"},"put":{"summary":"Save reconciliation restore payload","description":"Stores the latest reconciliation session payload for a case so it can be resumed on another device or in a later session.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v2\""},"description":"Current reconciliation restore revision ETag. Use v0 for the first save."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseReconciliationRestorePayload"},"example":{"invoice":{"filename":"acme-june-invoice.pdf"},"census":{"filename":"acme-census.xlsx"},"relinks":[],"corrections":{"m_42":{"status":"accepted"}}}}}},"responses":{"201":{"description":"Reconciliation restore payload saved","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","example":true}}},"example":{"success":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Case not found"}}}}}},"412":{"description":"Current revision no longer matches If-Match"},"428":{"description":"If-Match header required"},"500":{"description":"Failed to save reconciliation restore data"}},"operationId":"putCasesByCaseIdReconciliationRestore"}},"/api/cases/{caseId}/reconciliation-restore-history":{"get":{"summary":"List reconciliation restore revisions","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Revision metadata ordered newest first"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"}},"operationId":"listCaseReconciliationRestoreHistory"}},"/api/cases/{caseId}/reconciliation-restore-history/{version}/restore":{"post":{"summary":"Restore a reconciliation payload as a new revision","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v3\""}}],"responses":{"201":{"description":"Historical payload restored as a new latest revision"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case or revision not found"},"412":{"description":"Current revision no longer matches If-Match"},"428":{"description":"If-Match header required"}},"operationId":"restoreCaseReconciliationRestoreVersion"}},"/api/cases/{id}/report-data":{"get":{"summary":"Get case report data","description":"Returns computed JSON data for reports including PEPM, OOP scenarios, and analytics.","tags":["Cases","Analytics"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Report data with analytics","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"reportData":{"employerName":"Acme Corp","reportTypes":["medical","dental"],"planData":{"medical":[]},"enrollmentTiers":[]}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"reportData":{"type":"object","properties":{"employerName":{"type":"string"},"policyPeriod":{"type":"string"},"reportTypes":{"type":"array","items":{"type":"string"}},"planData":{"type":"object"},"enrollmentTiers":{"type":"array"},"contributionSettings":{"type":"object"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCaseReportData","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/report-data\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/report-data', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/report-data',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/bulk":{"post":{"summary":"Create multiple cases (bulk)","description":"Create up to 50 cases in a single request. Each input becomes a Postgres row plus an S3-backed case payload; failures on individual cases are captured per-result rather than failing the whole batch. Supports `X-Idempotency-Key` for at-most-once processing. Implementation: server/api/expanded-api.js.","tags":["Cases","Bulk Operations"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["cases"],"properties":{"cases":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"object","required":["employerName"],"properties":{"employerName":{"type":"string","minLength":1},"policyPeriod":{"type":"string","description":"Free-form policy period label (e.g. '2025 Plan Year')."},"planData":{"type":"object","description":"Map of benefit type (e.g. 'medical', 'dental') to an array of plan objects.","additionalProperties":{"type":"array","items":{"type":"object"}}},"metadata":{"type":"object","additionalProperties":true}}}},"generateReports":{"type":"boolean","default":false,"description":"Reserved for future use; reports are not generated by this endpoint today."}}},"example":{"cases":[{"employerName":"Acme Holdings","policyPeriod":"2026 Plan Year","planData":{}},{"employerName":"Beta Industries","policyPeriod":"2026 Plan Year"}],"generateReports":false}}}},"responses":{"200":{"description":"Batch processed. Per-case success/failure is in `results`; the request itself succeeds even when some cases fail.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"summary":{"type":"object","properties":{"total":{"type":"integer"},"created":{"type":"integer"},"failed":{"type":"integer"}}},"results":{"type":"array","items":{"type":"object","properties":{"success":{"type":"boolean"},"caseId":{"type":"string","description":"Present when success=true."},"employerName":{"type":"string"},"error":{"type":"string","description":"Present when success=false."}}}}}},"example":{"ok":true,"summary":{"total":2,"created":2,"failed":0},"results":[{"success":true,"caseId":"case-1730000000000-a1b2c3d4","employerName":"Acme Holdings"},{"success":true,"caseId":"case-1730000000001-e5f6a7b8","employerName":"Beta Industries"}]}}}},"400":{"description":"Validation failed (zod schema). `errors` contains zod issue descriptors.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"},"errors":{"type":"array","items":{"type":"object"}}}}}}},"503":{"description":"Database unavailable.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"}}},"example":{"ok":false,"error":"Database unavailable"}}}}},"operationId":"postCasesBulk"}},"/api/parse/file":{"post":{"summary":"Parse uploaded file","description":"Auto-detects file type and extracts structured plan data.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Parsed file data","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"plans":[{"planName":"PPO Gold","carrier":"UHC"}],"metadata":{"fileName":"rates.pdf","carrier":"UHC"}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"plans":{"type":"array","items":{"type":"object"}},"metadata":{"type":"object"},"warnings":{"type":"array","items":{"type":"string"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"parseFile","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/parse/file\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/parse/file', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/parse/file',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"PDF or document file to parse"},"documentType":{"type":"string","enum":["quote","invoice","sbc"],"description":"Type of document"}},"required":["file"]}}}}}},"/api/plans/validate":{"post":{"summary":"Validate plan data","description":"Validates plan data structure before import.","tags":["Plans"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Validation result","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"valid":true,"warnings":[]}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"valid":{"type":"boolean"},"errors":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"validatePlans","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"plans":[{"planName":"Gold PPO","carrier":"Blue Cross","benefitType":"medical","enrollmentAndRates":{"employee":{"enrolled":50,"rate":500}}}]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plans/validate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plan\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans/validate', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plan\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plans/validate',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plan\":{}}\n)\ndata = response.json()"}]}},"/api/compare/plans":{"post":{"summary":"Compare plans","description":"Side-by-side comparison with optional scoring.","tags":["Comparison","Plans"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Plan comparison data","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"comparison":{"plans":[],"metrics":{}}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"comparison":{"type":"object","properties":{"plans":{"type":"array"},"metrics":{"type":"object"},"summary":{"type":"object"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"comparePlans","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"planIds":["plan_abc","plan_def"],"metrics":["cost","coverage","network"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/compare/plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planIds\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/compare/plans', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planIds\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/compare/plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planIds\":[]}\n)\ndata = response.json()"}]}},"/api/estimate/costs":{"post":{"summary":"Estimate costs","description":"Estimate costs given plans, census, and contribution model.","tags":["Costing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Cost estimates","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"totalMonthly":32500,"totalAnnual":390000}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"totalMonthly":{"type":"number"},"totalAnnual":{"type":"number"},"byPlan":{"type":"array"},"byTier":{"type":"object"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"estimateCosts","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"plans":[{"planId":"plan_abc"}],"enrollment":{"employee":50,"employeeSpouse":20,"family":10},"frequency":12}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/estimate/costs\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/estimate/costs', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/estimate/costs',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[]}\n)\ndata = response.json()"}]}},"/api/market/benchmark":{"post":{"summary":"Get market benchmarks","description":"Market benchmark data by industry, location, and company size.","tags":["Market Data","Analytics"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market benchmark data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketBenchmarkResponse"}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postMarketBenchmark","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketBenchmarkRequest"}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/market/benchmark\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"industry\":\"tech\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/market/benchmark', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"industry\":\"tech\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/market/benchmark',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"industry\":\"tech\"}\n)\ndata = response.json()"}]}},"/api/analytics/cases":{"get":{"summary":"Get case analytics","description":"Case analytics including counts, trends, and top employers.","tags":["Analytics","Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Case analytics","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"analytics":{"totalCases":150,"byBenefitType":{"medical":120},"avgPlansPerCase":4.2}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"analytics":{"type":"object","properties":{"totalCases":{"type":"integer"},"byBenefitType":{"type":"object"},"avgPlansPerCase":{"type":"number"},"recentActivity":{"type":"array"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getCaseAnalytics","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/analytics/cases\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/analytics/cases', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/analytics/cases',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/costing/compute":{"post":{"summary":"Compute detailed costs","description":"Compute detailed cost breakdowns for plans.","tags":["Costing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Computed costs","content":{"application/json":{"examples":{"success":{"value":{"ok":true,"result":{"totalMonthly":32500}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{"type":"object","properties":{"totalMonthly":{"type":"number"},"totalAnnual":{"type":"number"},"erCost":{"type":"number"},"eeCost":{"type":"number"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"computeCosts","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"caseId":"case_abc123","contributionModel":{"type":"percentage","employerPercentage":80},"frequency":12}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/compute\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/compute', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/compute',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[]}\n)\ndata = response.json()"}]}},"/api/cases/{id}/tags":{"get":{"summary":"Get case tags","description":"Returns the tags array for a specific case.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Case tags","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"id":{"type":"string","description":"Unique identifier"},"tags":{"type":"array","items":{"type":"string"},"description":"User-defined tags for organization"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"tags":["renewal","medical","priority"]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByidTags","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/tags\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/tags', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/tags',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update case tags","description":"Replaces the tags array for a specific case.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string"},"description":"User-defined tags for organization"}},"required":["tags"]},"examples":{"default":{"summary":"Example request","value":{"tags":["renewal","medical","priority"]}}}}}},"responses":{"200":{"description":"Tags updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"id":{"type":"string","description":"Unique identifier"},"tags":{"type":"array","items":{"type":"string"},"description":"User-defined tags for organization"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"tags":["renewal","medical","priority"]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putCasesByidTags","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/cases/EXAMPLE_ID/tags\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"tags\":[\"renewal\",\"medical\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/tags', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"tags\":[\"renewal\",\"medical\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/tags',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"tags\":[\"renewal\",\"medical\"]}\n)\ndata = response.json()"}]}},"/api/cases/{id}/flat":{"get":{"summary":"Get flattened case data","description":"Returns case data as flattened key-value pairs. Useful for spreadsheet exports or data analysis.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Flattened case data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"id":{"type":"string","description":"Unique identifier"},"count":{"type":"integer","description":"Total count"},"rows":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string","description":"Dot-notation path to the value"},"value":{"description":"The value at this path"}}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"flat":{"caseId":"case-acme-2025","employerName":"Acme Corporation","currentPlanCount":2,"proposedPlanCount":3,"totalEnrollment":80}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByidFlat","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/flat\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/flat', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/flat',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/{id}/plans":{"get":{"summary":"Get case plans","description":"Returns normalized plan data for a case from the database.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"limit","in":"query","schema":{"type":"integer","default":500},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Plan data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Associated data"},"count":{"type":"integer","description":"Total count"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"plans":[{"id":"med-current-1","type":"current","benefitType":"medical","planName":"PPO Gold","carrier":"Aetna"},{"id":"med-proposed-1","type":"proposed","benefitType":"medical","planName":"HDHP Bronze","carrier":"United Healthcare","mapsToPlanId":"med-current-1"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByidPlans","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/plans', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/{id}/benefits":{"get":{"summary":"Get case benefits summary","description":"Returns a normalized benefits summary for all plans in a case.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"limit","in":"query","schema":{"type":"integer","default":1000},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Benefits data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"data":{"type":"array","items":{"type":"object"},"description":"Associated data"},"count":{"type":"integer","description":"Total count"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"benefits":{"med-current-1":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"},"primaryCare":{"value":"$25 copay"},"specialist":{"value":"$50 copay"},"emergencyRoom":{"value":"$300 copay"}}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByidBenefits","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/benefits\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/benefits', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/benefits',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/{id}/tiers":{"get":{"summary":"Get case tier data","description":"Returns per-tier enrollment and rate data for a case.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"limit","in":"query","schema":{"type":"integer","default":2000},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Tier data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"items":{"type":"array","items":{"type":"object"},"description":"Array of items"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"tiers":[{"id":"employee","label":"Employee Only"},{"id":"employeeSpouse","label":"Employee + Spouse"},{"id":"employeeChildren","label":"Employee + Children"},{"id":"family","label":"Family"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCasesByidTiers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/tiers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/tiers', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/tiers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Save case tier data","description":"Upserts per-tier metrics for a case.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"type":"object"}},"examples":{"default":{"summary":"Example request","value":{"tiers":[{"id":"employee","label":"Employee Only"},{"id":"family","label":"Family"}]}}}}}},"responses":{"200":{"description":"Tier data saved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"tiers":[{"id":"employee","label":"Employee Only"},{"id":"employeeSpouse","label":"Employee + Spouse"},{"id":"employeeChildren","label":"Employee + Children"},{"id":"family","label":"Family"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Plans per case limit exceeded (trial users)"}},"operationId":"postCasesByidTiers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases/EXAMPLE_ID/tiers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"tiers\":[{\"id\":\"employee\",\"label\":\"Employee Only\"}]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/tiers', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"tiers\":[{\"id\":\"employee\",\"label\":\"Employee Only\"}]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/tiers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"tiers\":[{\"id\":\"employee\",\"label\":\"Employee Only\"}]}\n)\ndata = response.json()"}]}},"/api/plan-library":{"get":{"summary":"List plan library items","description":"Returns plan library items for the authenticated user. Supports organization filtering.","tags":["Plan Library"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":25},"description":"Maximum number of results to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0},"description":"Number of results to skip"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Strict organization filter"},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Search plan name and carrier"},{"name":"platform","in":"query","required":false,"schema":{"type":"string"},"description":"Platform metadata filter"},{"name":"carrier","in":"query","required":false,"schema":{"type":"string"},"description":"Exact carrier filter"},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Benefit or plan-type filter"},{"name":"dateRange","in":"query","required":false,"schema":{"type":"string","enum":["This Week","This Month","Last 3 Months","This Year"]},"description":"Updated-date range"},{"name":"folderId","in":"query","required":false,"schema":{"type":"string"},"description":"Folder UUID, 'null' for unfiled plans, or '*' for no folder filter"},{"name":"userEmail","in":"query","required":false,"schema":{"type":"string","format":"email"},"description":"Email fallback for API-key callers evaluating domain sharing"}],"responses":{"200":{"description":"Paginated plan library items","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryListResponse"},"examples":{"response":{"summary":"Plan library items","value":{"ok":true,"items":[{"id":"pl_abc123","name":"Regence HDHP 3000","carrier":"Regence","benefitType":"medical","metadata":{}}],"count":1,"ts":"2025-01-01T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Organization access denied"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanLibrary","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library?category=medical&limit=50\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library?category=medical', {\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' }\n});\nconst { items } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},\n    params={'category': 'medical', 'limit': 50}\n)\nitems = response.json()['items']"}]},"post":{"summary":"Create plan library item","description":"Creates a new plan library item.","tags":["Plan Library"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"query","description":"Optional ID (auto-generated if not provided)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryItemCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"New PPO Template","category":"medical","visibility":"org"}}}}}},"responses":{"201":{"description":"Item created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryCreateResponse"}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Organization access denied"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postPlanLibrary","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-library\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"PPO Gold\",\"category\":\"medical\",\"carrier\":\"UHC\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"PPO Gold\",\"category\":\"medical\",\"carrier\":\"UHC\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-library',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"PPO Gold\",\"category\":\"medical\",\"carrier\":\"UHC\"}\n)\ndata = response.json()"}]}},"/api/plan-library/{id}":{"get":{"summary":"Get plan library item","description":"Returns a specific plan library item by ID.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Plan library item","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"item":{"$ref":"#/components/schemas/PlanLibraryItem"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"item":{"id":"lib-ppo-gold","name":"PPO Gold Template","category":"medical","visibility":"org","orgId":"org_xyz789","metadata":{"carrier":"Aetna","network":"PPO","region":"National"},"plan":{"benefitType":"medical","planName":"PPO Gold","benefits":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Item not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanLibraryByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update plan library item","description":"Updates an existing plan library item.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryItemCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"Updated PPO Template"}}}}}},"responses":{"200":{"description":"Item updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"item":{"$ref":"#/components/schemas/PlanLibraryItem"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"item":{"id":"lib-ppo-gold","name":"PPO Gold Template","category":"medical","visibility":"org","orgId":"org_xyz789","metadata":{"carrier":"Aetna","network":"PPO","region":"National"},"plan":{"benefitType":"medical","planName":"PPO Gold","benefits":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Item not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putPlanLibraryByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/plan-library/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"PPO Gold Updated\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"PPO Gold Updated\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"PPO Gold Updated\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete plan library item","description":"Deletes a plan library item.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Item deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"deleted":{"type":"boolean","description":"Whether item was deleted"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Item not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deletePlanLibraryByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/plan-library/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/{id}/history":{"get":{"summary":"Get plan library item version history","description":"Returns the version history for a plan library item.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Version history","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"versions":{"type":"array","items":{"type":"object","properties":{"versionId":{"type":"string"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"changedBy":{"type":"string"}}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"versions":[{"versionId":"v3","updatedAt":"2025-01-15T00:00:00Z","updatedBy":"user_abc123","changeNote":"Updated deductible values"},{"versionId":"v2","updatedAt":"2025-01-10T00:00:00Z","updatedBy":"user_abc123","changeNote":"Added OOP maximum"},{"versionId":"v1","updatedAt":"2025-01-01T00:00:00Z","updatedBy":"user_abc123","changeNote":"Initial creation"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanLibraryByidHistory","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/EXAMPLE_ID/history\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID/history', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID/history',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/{id}/restore/{versionId}":{"post":{"summary":"Restore plan library item version","description":"Restores a plan library item to a previous version.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"versionId","in":"path","required":true,"schema":{"type":"string"},"description":"Version identifier for history"}],"responses":{"200":{"description":"Version restored","content":{"application/json":{"schema":{"type":"object","required":["ok","restored","planData"],"properties":{"ok":{"type":"boolean","enum":[true]},"restored":{"type":"boolean","enum":[true]},"planData":{"type":"object","description":"Restored plan-version payload.","additionalProperties":true}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"item":{"id":"lib-ppo-gold","name":"PPO Gold Template","category":"medical","visibility":"org","orgId":"org_xyz789","metadata":{"carrier":"Aetna","network":"PPO","region":"National"},"plan":{"benefitType":"medical","planName":"PPO Gold","benefits":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Version not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postPlanLibraryByidRestoreByversionId","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-library/EXAMPLE_ID/restore/EXAMPLE_VERSION\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID/restore/EXAMPLE_VERSION', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID/restore/EXAMPLE_VERSION',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-templates":{"get":{"summary":"List plan templates","description":"Returns organization-level plan templates. Requires organization context.","tags":["Plan Templates"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Plan templates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"templates":{"type":"array","items":{"$ref":"#/components/schemas/PlanTemplate"}},"count":{"type":"integer","description":"Total count"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"templates":[{"id":"tmpl-standard-ppo","orgId":"org_xyz789","name":"Standard PPO Template","description":"Organization-wide PPO plan template","isDefault":true,"createdBy":"user_abc123","createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing organization ID"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanTemplates","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-templates\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-templates', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-templates',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Create plan template","description":"Creates a new organization-level plan template. Requires admin/owner role.","tags":["Plan Templates"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanTemplateCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"New Template","description":"Standard PPO template"}}}}}},"responses":{"200":{"description":"Template created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"template":{"$ref":"#/components/schemas/PlanTemplate"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"template":{"id":"tmpl-standard-ppo","orgId":"org_xyz789","name":"Standard PPO Template","description":"Organization-wide PPO plan template","isDefault":true,"createdBy":"user_abc123","createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing required fields"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions (admin/owner required)"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postPlanTemplates","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-templates\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"PPO Template\",\"benefitType\":\"medical\",\"template\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-templates', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"PPO Template\",\"benefitType\":\"medical\",\"template\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-templates',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"PPO Template\",\"benefitType\":\"medical\",\"template\":{}}\n)\ndata = response.json()"}]}},"/api/plan-templates/{id}":{"get":{"summary":"Get plan template","description":"Returns a specific plan template by ID.","tags":["Plan Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Plan template","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"template":{"$ref":"#/components/schemas/PlanTemplate"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"template":{"id":"tmpl-standard-ppo","orgId":"org_xyz789","name":"Standard PPO Template","description":"Organization-wide PPO plan template","isDefault":true,"createdBy":"user_abc123","createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-templates/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update plan template","description":"Updates an existing plan template. Requires admin/owner role.","tags":["Plan Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanTemplateCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"Updated Template"}}}}}},"responses":{"200":{"description":"Template updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"template":{"$ref":"#/components/schemas/PlanTemplate"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"template":{"id":"tmpl-standard-ppo","orgId":"org_xyz789","name":"Standard PPO Template","description":"Organization-wide PPO plan template","isDefault":true,"createdBy":"user_abc123","createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-15T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putPlanTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/plan-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Updated Template\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-templates/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"Updated Template\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/plan-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"Updated Template\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete plan template","description":"Deletes a plan template. Requires admin/owner role.","tags":["Plan Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Template deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"deleted":{"type":"boolean","description":"Whether item was deleted"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deletePlanTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/plan-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-templates/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/plan-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/disability-rate-templates":{"get":{"summary":"List disability rate templates","description":"Returns organization-scoped STD, LTD, and Life calculator rate templates for the authenticated user's active organization.","tags":["Disability Rate Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."},{"name":"coverage","in":"query","required":false,"schema":{"type":"string","enum":["std","ltd","life"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":500}}],"responses":{"200":{"description":"Disability rate templates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"coverage":{"type":"string","enum":["std","ltd","life"]},"name":{"type":"string"},"basis":{"type":"string","nullable":true,"enum":["benefit","wage",null]},"mode":{"type":"string","nullable":true},"plans":{"type":"array","items":{"type":"object"}},"createdBy":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true}}}},"count":{"type":"integer"},"ts":{"type":"string","format":"date-time"}}},"examples":{"response":{"summary":"Disability rate templates list","value":{"ok":true,"items":[{"id":"drt_001","coverage":"std","name":"Standard STD Rates","basis":"benefit","mode":"flat"}],"count":1,"ts":"2025-01-01T00:00:00Z"}}}}}},"400":{"description":"Invalid coverage"},"401":{"description":"Unauthorized"}},"operationId":"getDisabilityRateTemplates"},"post":{"summary":"Create or update disability rate template","description":"Creates or updates an organization-scoped STD, LTD, or Life calculator rate template.","tags":["Disability Rate Templates"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["coverage","name"],"properties":{"id":{"type":"string"},"coverage":{"type":"string","enum":["std","ltd","life"]},"name":{"type":"string"},"basis":{"type":"string","enum":["benefit","wage"]},"mode":{"type":"string"},"plans":{"type":"array","items":{"type":"object"}}}}}}},"responses":{"201":{"description":"Saved disability rate template"},"400":{"description":"Invalid argument"},"401":{"description":"Unauthorized"}},"operationId":"postDisabilityRateTemplates"}},"/api/disability-rate-templates/{id}":{"delete":{"summary":"Delete disability rate template","description":"Deletes an organization-scoped disability/life calculator rate template by id.","tags":["Disability Rate Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."}],"responses":{"200":{"description":"Deleted disability rate template","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"deleted":{"type":"boolean"},"ts":{"type":"string","format":"date-time"}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Template not found"}},"operationId":"deleteDisabilityRateTemplatesByid"}},"/api/brand-templates":{"get":{"summary":"List brand templates","description":"Returns organization-scoped brand and agency profile templates for the authenticated user's active organization.","tags":["Brand Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":500}}],"responses":{"200":{"description":"Brand templates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"items":{"type":"array","items":{"type":"object"}},"count":{"type":"integer"},"ts":{"type":"string","format":"date-time"}}},"examples":{"response":{"summary":"Brand templates list","value":{"ok":true,"items":[{"id":"bt_001","name":"Default Brand","isDefault":true,"template":{"colors":{"primary":"#0284c7"}}}],"count":1,"ts":"2025-01-01T00:00:00Z"}}}}}},"401":{"description":"Unauthorized"}},"operationId":"getBrandTemplates"},"post":{"summary":"Create or update brand template","description":"Creates or updates an organization-scoped brand or agency profile template.","tags":["Brand Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"template":{"type":"object"},"profile":{"type":"object"},"branding":{"type":"object"},"isDefault":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Saved brand template"},"400":{"description":"Invalid argument"},"401":{"description":"Unauthorized"}},"operationId":"postBrandTemplates"}},"/api/brand-templates/{id}":{"put":{"summary":"Update brand template","description":"Updates an organization-scoped brand or agency profile template by id.","tags":["Brand Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Saved brand template","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"item":{"type":"object"},"ts":{"type":"string","format":"date-time"}}}}}},"400":{"description":"Invalid argument"},"401":{"description":"Unauthorized"}},"operationId":"putBrandTemplatesByid"},"delete":{"summary":"Delete brand template","description":"Deletes an organization-scoped brand or agency profile template by id.","tags":["Brand Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."}],"responses":{"200":{"description":"Deleted brand template","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"deleted":{"type":"boolean"},"ts":{"type":"string","format":"date-time"}}}}}},"401":{"description":"Unauthorized"},"404":{"description":"Template not found"}},"operationId":"deleteBrandTemplatesByid"}},"/api/contribution-templates":{"get":{"summary":"List contribution templates","description":"Returns contribution templates for the authenticated user.","tags":["Contribution Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Optional organization id. The caller must be a member of the requested organization."},{"name":"scope","in":"query","schema":{"type":"string","enum":["all","org","private"],"default":"all"},"description":"Template visibility scope to list."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":1000,"default":500},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Contribution templates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"items":{"type":"array","items":{"$ref":"#/components/schemas/ContributionTemplate"},"description":"Array of items"},"count":{"type":"integer","description":"Total count"},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"templates":[{"id":"contrib-tiered","orgId":"org_xyz789","name":"Standard Tiered Contribution","description":"75% employer contribution for EE, 50% for dependents","config":{"modelType":"tiered","frequency":24,"models":{"global":{"employee":{"type":"%","value":75},"spouse":{"type":"%","value":50},"children":{"type":"%","value":50},"family":{"type":"%","value":50}}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-10T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getContributionTemplates","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/contribution-templates\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/contribution-templates',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Create contribution template","description":"Creates a new contribution template.","tags":["Contribution Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"query","description":"Optional ID (auto-generated if not provided)","schema":{"type":"string"}},{"name":"orgId","in":"query","description":"Optional organization id. Required to save an organization-scoped template for a non-primary org.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionTemplateCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"New Contribution Template","config":{"modelType":"tiered"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"},"example":{"ok":true,"template":{"id":"tpl_abc123","name":"Standard 80/20 Split","description":"80% employer, 20% employee contribution","contributionModel":{"type":"percentage","employerPercentage":80},"createdAt":"2024-01-15T10:30:00Z"}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"201":{"description":"Template created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"item":{"$ref":"#/components/schemas/ContributionTemplate"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postContributionTemplates","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/contribution-templates\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"75/50 Split\",\"modelType\":\"tiered\",\"models\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"75/50 Split\",\"modelType\":\"tiered\",\"models\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/contribution-templates',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"75/50 Split\",\"modelType\":\"tiered\",\"models\":{}}\n)\ndata = response.json()"}]}},"/api/contribution-templates/{id}":{"get":{"summary":"Get contribution template","description":"Returns a specific contribution template by ID.","tags":["Contribution Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Optional organization id for organization-scoped template access."}],"responses":{"200":{"description":"Contribution template","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"item":{"$ref":"#/components/schemas/ContributionTemplate"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"template":{"id":"contrib-tiered","orgId":"org_xyz789","name":"Standard Tiered Contribution","description":"75% employer contribution for EE, 50% for dependents","config":{"modelType":"tiered","frequency":24,"models":{"global":{"employee":{"type":"%","value":75},"spouse":{"type":"%","value":50},"children":{"type":"%","value":50},"family":{"type":"%","value":50}}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-10T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getContributionTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/contribution-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/contribution-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update contribution template","description":"Updates an existing contribution template.","tags":["Contribution Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Optional organization id for organization-scoped template updates."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContributionTemplateCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"Updated Contribution"}}}}}},"responses":{"200":{"description":"Template updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"item":{"$ref":"#/components/schemas/ContributionTemplate"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"template":{"id":"contrib-tiered","orgId":"org_xyz789","name":"Standard Tiered Contribution","description":"75% employer contribution for EE, 50% for dependents","config":{"modelType":"tiered","frequency":24,"models":{"global":{"employee":{"type":"%","value":75},"spouse":{"type":"%","value":50},"children":{"type":"%","value":50},"family":{"type":"%","value":50}}}},"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-10T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putContributionTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/contribution-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Updated Contribution\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"Updated Contribution\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/contribution-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"Updated Contribution\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete contribution template","description":"Deletes a contribution template.","tags":["Contribution Templates"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Optional organization id for organization-scoped template deletion."}],"responses":{"200":{"description":"Template deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"deleted":{"type":"boolean","description":"Whether item was deleted"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Template not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deleteContributionTemplatesByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/contribution-templates/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/contribution-templates/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/location/lookup-zip":{"post":{"summary":"Lookup ZIP code","description":"Returns location information for a US ZIP code including city, state, and coordinates.","tags":["Location"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"zipCode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$","description":"5-digit ZIP code or ZIP+4"}},"required":["zipCode"]},"examples":{"default":{"summary":"Example request","value":{"zip":"90210"}}}}}},"responses":{"200":{"description":"Location data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"location":{"$ref":"#/components/schemas/LocationData"},"timestamp":{"type":"string","format":"date-time","description":"Event timestamp"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"location":{"zip":"90210","city":"Beverly Hills","state":"CA","county":"Los Angeles","latitude":34.0901,"longitude":-118.4065,"timezone":"America/Los_Angeles"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid ZIP code format"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postLocationLookupZip","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/location/lookup-zip\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"zipCode\":\"90210\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/location/lookup-zip', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"zipCode\":\"90210\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/location/lookup-zip',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"zipCode\":\"90210\"}\n)\ndata = response.json()"}]}},"/api/location/reverse-geocode":{"post":{"summary":"Reverse geocode","description":"Returns location information for latitude/longitude coordinates.","tags":["Location"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90,"description":"Latitude"},"lon":{"type":"number","minimum":-180,"maximum":180,"description":"Longitude"}},"required":["lat","lon"]},"examples":{"default":{"summary":"Example request","value":{"latitude":34.0901,"longitude":-118.4065}}}}}},"responses":{"200":{"description":"Location data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"location":{"$ref":"#/components/schemas/LocationData"},"timestamp":{"type":"string","format":"date-time","description":"Event timestamp"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"location":{"address":"123 Rodeo Drive","city":"Beverly Hills","state":"CA","zip":"90210","county":"Los Angeles"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid coordinates"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postLocationReverseGeocode","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/location/reverse-geocode\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"lat\":34.0901,\"lng\":-118.4065}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/location/reverse-geocode', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"lat\":34.0901,\"lng\":-118.4065})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/location/reverse-geocode',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"lat\":34.0901,\"lng\":-118.4065}\n)\ndata = response.json()"}]}},"/api/market/benchmarks":{"get":{"summary":"Get market benchmarks","description":"Returns market benchmark data for benefits by industry and location.","tags":["Market Data"],"security":[],"parameters":[{"name":"industry","in":"query","description":"Industry vertical","schema":{"type":"string","default":"technology"}},{"name":"location","in":"query","description":"Geographic region (e.g., 'CA', 'national')","schema":{"type":"string","default":"national"}},{"name":"benefitTypes","in":"query","description":"Comma-separated benefit types","schema":{"type":"string","default":"deductible,oop,premiums"}}],"responses":{"200":{"description":"Benchmark data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"data":{"type":"object","description":"Benchmark data by benefit type","additionalProperties":{"type":"object","properties":{"min":{"type":"number","description":"Minimum value"},"max":{"type":"number","description":"Maximum value"},"median":{"type":"number"},"p25":{"type":"number"},"p75":{"type":"number"}}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"benchmarks":{"medical":{"averagePremium":{"employee":650,"family":1800},"deductibleRange":{"low":500,"median":1500,"high":5000},"oopRange":{"low":3000,"median":6000,"high":8500}},"dental":{"averagePremium":{"employee":45,"family":120}},"vision":{"averagePremium":{"employee":12,"family":35}}},"source":"Kaiser Family Foundation 2024","asOf":"2024-09-01"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getMarketBenchmarks","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/market/benchmarks\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/market/benchmarks', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/market/benchmarks',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/auth/config":{"get":{"summary":"Get auth configuration","description":"Returns the authentication configuration including Cognito settings.","tags":["System"],"security":[],"responses":{"200":{"description":"Auth configuration","content":{"application/json":{"schema":{"type":"object","properties":{"region":{"type":"string","description":"AWS region"},"userPoolId":{"type":"string"},"clientId":{"type":"string"},"domain":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"cognito":{"region":"us-east-1","userPoolId":"us-east-1_xxxxx","clientId":"xxxxxxxxxxxxxxxxx"},"google":{"enabled":true,"clientId":"xxxxx.apps.googleusercontent.com"},"features":{"mfa":true,"sso":false}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAuthConfig","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/auth/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/auth/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/auth/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/auth/config/full":{"get":{"operationId":"getAuthConfigFull","summary":"Get full auth configuration (admin only)","description":"Returns the complete authentication configuration, including the allowlist roster (allowedEmails, allowedDomains, groups) and admin identities (envAdmins, admins). Admin-gated and served with Cache-Control: private, no-store. The unauthenticated GET /api/auth/config deliberately omits these fields because it is CDN-cacheable and world-readable.","tags":["System"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Full auth configuration including allowlist roster and admin identities","content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","description":"Allowlist mode"},"allowedEmails":{"type":"array","items":{"type":"string"}},"allowedDomains":{"type":"array","items":{"type":"string"}},"groups":{"type":"object","additionalProperties":true},"uiRules":{"type":"object","additionalProperties":true},"requiredGroups":{"type":"array","items":{"type":"string"}},"envAdmins":{"type":"array","items":{"type":"string"}},"admins":{"type":"array","items":{"type":"string"}},"ts":{"type":"string","format":"date-time"},"source":{"type":"string","description":"Where the config was resolved from"}}},"examples":{"success":{"summary":"Successful response","value":{"mode":"allowlist","allowedEmails":["admin@example.com"],"allowedDomains":["example.com"],"groups":{},"uiRules":{},"requiredGroups":[],"envAdmins":["admin@example.com"],"admins":["admin@example.com"],"ts":"2026-07-31T00:00:00.000Z","source":"s3"}}}}},"headers":{"Cache-Control":{"description":"Always private, no-store. This body is privileged and must never be cached by a CDN or proxy.","schema":{"type":"string","example":"private, no-store"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/health":{"get":{"summary":"API health check","tags":["System"],"security":[],"responses":{"200":{"description":"API is healthy","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok","description":"Current status"},"timestamp":{"type":"string","format":"date-time","description":"Event timestamp"}}},"examples":{"success":{"summary":"Successful response","value":{"status":"healthy","version":"1.0.0","uptime":86400,"timestamp":"2025-01-15T10:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getHealth","description":"API health check","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/export/run":{"post":{"summary":"Export a completed artifact (legacy compatibility)","description":"Returns a real PDF, XLSX, or CSV artifact immediately. PDF requires data.html and XLSX requires data.reportData. DOCX is rejected because no DOCX generator exists; use the versioned integration endpoints for new work.","tags":["Export"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["pdf","docx","xlsx","csv"],"description":"Data format"},"data":{"type":"object","description":"Export payload data"},"callbackUrl":{"type":"string","format":"uri","description":"Not supported. Supplying this value returns callback_not_supported."}},"required":["data"]},"examples":{"default":{"summary":"Example request","value":{"format":"pdf","data":{"filename":"proposal-book.pdf","html":"<html><body><h1>Proposal Book</h1></body></html>","options":{"landscape":false}}}}}}}},"responses":{"200":{"description":"Completed artifact response","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"202":{"description":"Job queued","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"exportId":{"type":"string"},"status":{"type":"string","description":"Current status"},"format":{"type":"string","description":"Data format"}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Feature disabled"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postExportRun","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/export/run\" \\\n  -H \"Authorization: Bearer YOUR_ACCESS_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"format\":\"pdf\",\"data\":{\"filename\":\"proposal-book.pdf\",\"html\":\"<html><body>Proposal Book</body></html>\"}}' \\\n  -o proposal-book.pdf"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/export/run', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify({ format: 'pdf', data: { filename: 'proposal-book.pdf', html: '<html><body>Proposal Book</body></html>' } })\n});\nconst pdf = await response.blob(); // The artifact is returned immediately; do not poll legacy status URLs."},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/export/run',\n    headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},\n    json={'format': 'pdf', 'data': {'filename': 'proposal-book.pdf', 'html': '<html><body>Proposal Book</body></html>'}}\n)\nresponse.raise_for_status()\nopen('proposal-book.pdf', 'wb').write(response.content) # Immediate artifact; no polling."}],"x-rateLimit":{"limit":5,"window":"1m","description":"Export generation requires significant resources"}}},"/api/export/status/{id}":{"get":{"summary":"Removed legacy export status endpoint","description":"Get export job status","deprecated":true,"tags":["Export"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"exportId":{"type":"string"},"status":{"type":"string","enum":["pending","processing","completed","failed"],"description":"Current status"},"format":{"type":"string","description":"Data format"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"exportId":"export-xyz789","status":"completed","progress":100,"createdAt":"2025-01-15T10:00:00Z","completedAt":"2025-01-15T10:00:25Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getExportStatusByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"# Removed endpoint: this request returns HTTP 410. Use the synchronous export response or /api/v1/integrations artifact handoff."},{"lang":"javascript","label":"JavaScript","source":"// Removed endpoint: HTTP 410. Do not poll legacy export status URLs."},{"lang":"python","label":"Python","source":"# Removed endpoint: HTTP 410. Use the initiating export response."}]}},"/api/export/url/{id}":{"get":{"summary":"Removed legacy export URL endpoint","description":"Returns 410. /api/export/run returns artifacts synchronously.","deprecated":true,"tags":["Export"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Download URL","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"exportId":{"type":"string"},"status":{"type":"string","description":"Current status"},"format":{"type":"string","description":"Data format"},"url":{"type":"string","format":"uri","description":"URL reference"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"exportId":"export-xyz789","url":"https://storage.example.com/exports/export-xyz789.pdf","expiresAt":"2025-01-15T11:00:00Z","filename":"Acme-Corporation-Benefits-Analysis-2025.pdf"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getExportUrlByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"# Removed endpoint: this request returns HTTP 410."},{"lang":"javascript","label":"JavaScript","source":"// Removed endpoint: HTTP 410."},{"lang":"python","label":"Python","source":"# Removed endpoint: HTTP 410."}]}},"/api/export/result/{id}":{"get":{"summary":"Removed legacy export result endpoint","description":"Returns 410. Artifacts are returned by the initiating export request.","deprecated":true,"tags":["Export"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"disposition","in":"query","schema":{"type":"string","enum":["inline","attachment"]},"description":"Query parameter for filtering or options"}],"responses":{"200":{"description":"Binary export file. Use Content-Type header to determine format:\n- application/pdf - PDF document\n- application/vnd.openxmlformats-officedocument.wordprocessingml.document - Word (.docx)\n- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - Excel (.xlsx)\n- text/csv - CSV file","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{"schema":{"type":"string","format":"binary"}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"text/csv":{"schema":{"type":"string"}}},"headers":{"Content-Type":{"description":"MIME type of the exported file","schema":{"type":"string","example":"application/pdf"}},"Content-Disposition":{"description":"Suggested filename for download","schema":{"type":"string","example":"attachment; filename=\"benefits-report.pdf\""}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"409":{"description":"Not ready"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getExportResultByid","x-codeSamples":[{"lang":"curl","label":"cURL (Download PDF)","source":"# Removed endpoint: HTTP 410. The initiating export returns the artifact."},{"lang":"curl","label":"cURL (Download Excel)","source":"# Removed endpoint: HTTP 410."},{"lang":"javascript","label":"JavaScript","source":"// Removed endpoint: HTTP 410."},{"lang":"python","label":"Python","source":"# Removed endpoint: HTTP 410."}]}},"/api/webhooks/status":{"get":{"summary":"Webhook service status","tags":["Webhooks"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookStatusResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"enabled":{"stripe":true,"slack":true,"hubspot":false,"salesforce":false,"generic":true}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getWebhooksStatus","description":"Check which webhook providers are configured and enabled.","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/webhooks/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/webhooks/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/webhooks/stripe":{"post":{"summary":"Stripe webhook","tags":["Webhooks"],"security":[],"parameters":[{"name":"Stripe-Signature","in":"header","required":true,"schema":{"type":"string"},"description":"Parameter: Stripe-Signature"}],"requestBody":{"description":"Stripe webhook event payload","required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Resource type"},"data":{"type":"object","description":"Associated data"}}},"examples":{"subscriptionEvent":{"value":{"type":"customer.subscription.updated","data":{"object":{"id":"sub_xxx","status":"active"}}}}}}}},"responses":{"200":{"description":"Webhook processed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"received":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"received":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Signature invalid"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postWebhooksStripe","description":"Stripe webhook","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/webhooks/stripe\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/stripe', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/webhooks/stripe',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/webhooks/generic":{"post":{"summary":"Generic webhook","description":"Generic webhook endpoint secured by shared secret.","tags":["Webhooks"],"security":[],"parameters":[{"name":"x-webhook-secret","in":"header","schema":{"type":"string"},"description":"Parameter: x-webhook-secret"},{"name":"token","in":"query","schema":{"type":"string"},"description":"Authentication or share token"}],"requestBody":{"description":"Generic webhook payload","required":true,"content":{"application/json":{"schema":{"type":"object"},"examples":{"generic":{"value":{"event":"custom.event","data":{}}}}}}},"responses":{"200":{"description":"Webhook processed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"received":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"received":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"description":"Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postWebhooksGeneric","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/webhooks/generic\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/generic', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/webhooks/generic',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/organizations/list":{"get":{"summary":"List user's organizations","description":"Returns all organizations the authenticated user is a member of.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of organizations","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organizations":{"type":"array","items":{"$ref":"#/components/schemas/Organization"}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organizations":[{"id":"org_xyz789","name":"Benefits Consulting Group","slug":"bcg","ownerId":"user_abc123","memberCount":15,"plan":"professional","createdAt":"2024-06-01T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"501":{"description":"CloudSQL not enabled"}},"operationId":"getOrganizationsList","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/list\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/list', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/list',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/select":{"post":{"summary":"Select active organization","description":"Sets the authenticated user's active organization after verifying membership.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization id or external id to select"}],"responses":{"200":{"description":"Active organization selected","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"primary_org_id":{"type":"string"},"organization":{"$ref":"#/components/schemas/Organization"},"userRole":{"type":"string"}}}}}},"400":{"description":"Organization id required"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User is not an active member of the organization"},"404":{"description":"Organization not found"},"501":{"description":"CloudSQL not enabled"}},"operationId":"selectOrganization"}},"/api/organizations/create":{"post":{"summary":"Create organization","description":"Deprecated compatibility alias. Use POST /api/organizations.","deprecated":true,"tags":["Organizations"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"New Benefits Agency","slug":"nba"}}}}}},"responses":{"200":{"description":"Organization created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"$ref":"#/components/schemas/Organization"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organization":{"id":"org_new123","name":"New Benefits Agency","slug":"nba","ownerId":"user_abc123","memberCount":1,"plan":"free","createdAt":"2025-01-15T10:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Organization creation failed"}},"operationId":"postOrganizationsCreate","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/create\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"My Company\",\"slug\":\"my-company\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/create', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"My Company\",\"slug\":\"my-company\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/create',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"My Company\",\"slug\":\"my-company\"}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}":{"get":{"summary":"Get organization","description":"Returns organization details. User must be a member.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"Organization details","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"$ref":"#/components/schemas/Organization"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organization":{"id":"org_xyz789","name":"Benefits Consulting Group","slug":"bcg","ownerId":"user_abc123","settings":{"defaultCaseVisibility":"org","requireApproval":false,"branding":{"logo":"https://example.com/logo.png","primaryColor":"#003366"}},"memberCount":15,"plan":"professional","features":["unlimited-cases","api-access","custom-exports"],"createdAt":"2024-06-01T00:00:00Z","updatedAt":"2025-01-10T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not a member"},"404":{"description":"Organization not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsByorgId","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update organization","description":"Updates organization details. Requires admin/owner role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"},"examples":{"default":{"summary":"Example request","value":{"name":"Updated Organization Name"}}}}}},"responses":{"200":{"description":"Organization updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"$ref":"#/components/schemas/Organization"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organization":{"id":"org_xyz789","name":"Benefits Consulting Group","slug":"bcg","ownerId":"user_abc123","settings":{"defaultCaseVisibility":"org","requireApproval":false,"branding":{"logo":"https://example.com/logo.png","primaryColor":"#003366"}},"memberCount":15,"plan":"professional","features":["unlimited-cases","api-access","custom-exports"],"createdAt":"2024-06-01T00:00:00Z","updatedAt":"2025-01-10T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions"},"404":{"description":"Organization not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putOrganizationsByorgId","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/organizations/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Updated Name\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"Updated Name\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"Updated Name\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete organization","description":"Deletes an organization. Requires owner role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"Organization deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"deleted":{"type":"boolean","description":"Whether item was deleted"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not owner"},"404":{"description":"Organization not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deleteOrganizationsByorgId","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/organizations/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/stats":{"get":{"summary":"Get organization statistics","description":"Returns usage statistics for an organization.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"Organization statistics","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"stats":{"type":"object","properties":{"memberCount":{"type":"integer"},"caseCount":{"type":"integer"},"planLibraryCount":{"type":"integer"}},"description":"Statistics"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"stats":{"totalCases":245,"activeCases":32,"totalMembers":15,"parseCreditsUsed":1250,"parseCreditsRemaining":3750,"storageUsedMB":2048,"exportCount":89},"period":"2025-01"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not a member"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsByorgIdStats","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/EXAMPLE_ID/stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/members":{"get":{"summary":"List organization members","description":"Returns all members of an organization with their roles.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"List of members","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"members":{"type":"array","items":{"$ref":"#/components/schemas/TeamMember"}},"count":{"type":"integer","description":"Total count"},"limit":{"type":"integer","description":"Maximum limit"},"offset":{"type":"integer","description":"Pagination offset"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"members":[{"userId":"user_abc123","email":"owner@example.com","name":"John Owner","role":"owner","joinedAt":"2024-06-01T00:00:00Z","lastActiveAt":"2025-01-15T09:00:00Z"},{"userId":"user_def456","email":"admin@example.com","name":"Jane Admin","role":"admin","joinedAt":"2024-07-15T00:00:00Z","lastActiveAt":"2025-01-14T16:30:00Z"},{"userId":"user_ghi789","email":"member@example.com","name":"Bob Member","role":"member","joinedAt":"2024-09-01T00:00:00Z","lastActiveAt":"2025-01-13T11:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not a member"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsByorgIdMembers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/EXAMPLE_ID/members\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/members', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/members',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/members/activity":{"get":{"summary":"Get member activity","description":"Returns activity/audit log for organization members.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"Member activity","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"activities":{"type":"object"},"count":{"type":"integer","description":"Total count"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"activity":[{"userId":"user_abc123","action":"case.created","resource":"case-acme-2025","timestamp":"2025-01-15T10:30:00Z"},{"userId":"user_def456","action":"export.generated","resource":"export-xyz789","timestamp":"2025-01-15T09:45:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not a member"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsByorgIdMembersActivity","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/EXAMPLE_ID/members/activity\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/members/activity', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/members/activity',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/invitations":{"get":{"summary":"List invitations","description":"Returns pending invitations for the organization.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"List of invitations","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"invitations":{"type":"array","items":{"$ref":"#/components/schemas/Invitation"}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"invitations":[{"id":"inv_abc123","email":"newmember@example.com","role":"member","invitedBy":"user_abc123","status":"pending","expiresAt":"2025-01-22T00:00:00Z","createdAt":"2025-01-15T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsByorgIdInvitations","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Create invitation","description":"Sends an invitation to join the organization.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","description":"Email address"},"role":{"type":"string","enum":["viewer","editor","admin"],"default":"viewer","description":"User role (owner, admin, member)"}},"required":["email"]},"examples":{"default":{"summary":"Example request","value":{"email":"newmember@example.com","role":"member"}}}}}},"responses":{"200":{"description":"Invitation sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"invitation":{"$ref":"#/components/schemas/Invitation"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid email or already member"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Insufficient permissions"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postOrganizationsByorgIdInvitations","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"user@example.com\",\"role\":\"member\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"email\":\"user@example.com\",\"role\":\"member\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"email\":\"user@example.com\",\"role\":\"member\"}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/shared-content":{"get":{"summary":"List organization shared content","description":"Returns cases and plans visible through an organization with their current sharing state.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization id"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":100},"description":"Maximum number of content records to return"}],"responses":{"200":{"description":"Shared content inventory","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"orgId":{"type":"string"},"cases":{"type":"array","items":{"type":"object"}},"plans":{"type":"array","items":{"type":"object"}},"summary":{"type":"object","nullable":true},"limited":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have organization access"},"500":{"description":"Failed to load shared content inventory"}},"operationId":"getOrganizationSharedContent"}},"/api/organizations/{orgId}/shared-content/{contentType}/{contentId}":{"patch":{"summary":"Update organization shared content access","description":"Updates organization-managed access for a shared case or plan.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization id"},{"name":"contentType","in":"path","required":true,"schema":{"type":"string","enum":["case","plan"]},"description":"Shared content type"},{"name":"contentId","in":"path","required":true,"schema":{"type":"string"},"description":"Shared content id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"type":"string","description":"New organization visibility setting"},"sharedWithOrg":{"type":"boolean","description":"Whether the item should remain shared with the organization"}}}}}},"responses":{"200":{"description":"Shared content access updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"item":{"type":"object"}}}}}},"400":{"description":"Invalid content type, visibility, or unsupported change"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have organization settings access"},"404":{"description":"Shared content not found"},"500":{"description":"Failed to update shared content access"}},"operationId":"patchOrganizationSharedContentAccess"}},"/api/organizations/{orgId}/transfer-ownership":{"post":{"summary":"Transfer ownership","description":"Transfers organization ownership to another member. Current owner becomes admin.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"newOwnerId":{"type":"string","description":"User ID of new owner"}},"required":["newOwnerId"]},"examples":{"default":{"summary":"Example request","value":{"newOwnerId":"user_def456"}}}}}},"responses":{"200":{"description":"Ownership transferred","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"transferred":{"type":"boolean"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Not owner"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postOrganizationsByorgIdTransferOwnership","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/EXAMPLE_ID/transfer-ownership\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"newOwnerId\":\"user-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/transfer-ownership', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"newOwnerId\":\"user-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/transfer-ownership',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"newOwnerId\":\"user-123\"}\n)\ndata = response.json()"}]}},"/api/user/profile":{"get":{"summary":"Get user profile","description":"Returns the authenticated user's profile.","tags":["User"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"User profile","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"profile":{"$ref":"#/components/schemas/UserProfile"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"profile":{"id":"user_abc123","email":"user@example.com","name":"John Smith","avatar":"https://example.com/avatar.png","preferences":{"theme":"light","defaultExportFormat":"pdf","emailNotifications":true},"createdAt":"2024-01-01T00:00:00Z","lastLoginAt":"2025-01-15T08:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Profile not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getUserProfile","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/user/profile\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/profile', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/user/profile',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update user profile","description":"Updates the authenticated user's profile.","tags":["User"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileUpdate"},"examples":{"default":{"summary":"Example request","value":{"name":"John Smith Jr.","preferences":{"theme":"dark","emailNotifications":false}}}}}}},"responses":{"200":{"description":"Profile updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"profile":{"$ref":"#/components/schemas/UserProfile"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"profile":{"id":"user_abc123","email":"user@example.com","name":"John Smith","avatar":"https://example.com/avatar.png","preferences":{"theme":"light","defaultExportFormat":"pdf","emailNotifications":true},"createdAt":"2024-01-01T00:00:00Z","lastLoginAt":"2025-01-15T08:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"No valid fields provided"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Invalid primary org"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putUserProfile","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/user/profile\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"displayName\":\"John Smith\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/profile', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"displayName\":\"John Smith\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/user/profile',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"displayName\":\"John Smith\"}\n)\ndata = response.json()"}]}},"/api/user/initialize":{"post":{"summary":"Initialize user","description":"Initializes a new user profile after first login.","tags":["User"],"security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"displayName":{"type":"string","description":"Formatted display name"},"email":{"type":"string","format":"email","description":"Email address"}}},"examples":{"default":{"summary":"Example request","value":{"name":"New User","referralCode":"REF123"}}}}}},"responses":{"200":{"description":"User initialized","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"profile":{"$ref":"#/components/schemas/UserProfile"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"profile":{"id":"user_new123","email":"newuser@example.com","name":"New User","createdAt":"2025-01-15T10:00:00Z"},"trialDaysRemaining":14}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postUserInitialize","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/user/initialize\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/initialize', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/user/initialize',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/user/quota":{"get":{"summary":"Get user quota","description":"Returns the user's usage quota and limits.","tags":["User"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"User quota","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"quota":{"type":"object","properties":{"cases":{"type":"object","properties":{"used":{"type":"integer","description":"Amount/count used"},"limit":{"type":"integer","description":"Maximum limit"}}},"exports":{"type":"object","properties":{"used":{"type":"integer","description":"Amount/count used"},"limit":{"type":"integer","description":"Maximum limit"}}},"aiCredits":{"type":"object","properties":{"used":{"type":"integer","description":"Amount/count used"},"limit":{"type":"integer","description":"Maximum limit"}}}},"description":"Quota information"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"quota":{"parseCalls":{"used":45,"limit":100,"resetAt":"2025-02-01T00:00:00Z"},"cases":{"used":12,"limit":50},"storage":{"usedMB":256,"limitMB":1024},"exports":{"used":8,"limit":25,"resetAt":"2025-02-01T00:00:00Z"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getUserQuota","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/user/quota\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/quota', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/user/quota',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/subscriptions/current":{"get":{"summary":"Get current subscription","description":"Returns the authenticated user's active subscription.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Current subscription","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"subscription":{"$ref":"#/components/schemas/Subscription"},"has_subscription":{"type":"boolean"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"subscription":{"id":"sub_xyz789","plan":"professional","status":"active","currentPeriodStart":"2025-01-01T00:00:00Z","currentPeriodEnd":"2025-02-01T00:00:00Z","cancelAtPeriodEnd":false,"features":["unlimited-cases","api-access","priority-support"]}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getSubscriptionsCurrent","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/subscriptions/current\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/subscriptions/current', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/subscriptions/current',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/subscriptions/create":{"post":{"summary":"Create subscription","description":"Creates a new subscription for the user.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreate"},"examples":{"default":{"summary":"Example request","value":{"planId":"professional","paymentMethodId":"pm_xyz789"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"},"example":{"ok":true,"subscription":{"id":"sub_abc123","customerId":"cus_xyz789","status":"active","plan":"professional","currentPeriodStart":"2024-01-01T00:00:00Z","currentPeriodEnd":"2024-02-01T00:00:00Z"},"clientSecret":"pi_xxx_secret_yyy"}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"201":{"description":"Subscription created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"subscription":{"$ref":"#/components/schemas/Subscription"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Subscription creation failed"}},"operationId":"postSubscriptionsCreate","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/subscriptions/create\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"priceId\":\"price_123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/subscriptions/create', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"priceId\":\"price_123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/subscriptions/create',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"priceId\":\"price_123\"}\n)\ndata = response.json()"}]}},"/api/subscriptions/cancel":{"post":{"summary":"Cancel subscription","description":"Cancels the user's active subscription.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Subscription canceled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"canceled":{"type":"boolean"},"subscription_id":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No active subscription"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postSubscriptionsCancel","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/subscriptions/cancel\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/subscriptions/cancel', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/subscriptions/cancel',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{}}}}}},"/api/subscriptions/upgrade":{"post":{"summary":"Upgrade subscription","description":"Upgrades the user's subscription to a higher tier.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan_id":{"type":"string","description":"Target plan ID"}},"required":["plan_id"]},"examples":{"default":{"summary":"Example request","value":{"planId":"professional"}}}}}},"responses":{"200":{"description":"Subscription upgraded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"upgraded":{"type":"boolean"},"subscription":{"$ref":"#/components/schemas/Subscription"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"subscription":{"id":"sub_new123","plan":"professional","status":"active","clientSecret":"pi_xxx_secret_yyy"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"No active subscription"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postSubscriptionsUpgrade","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/subscriptions/upgrade\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"priceId\":\"price_456\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/subscriptions/upgrade', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"priceId\":\"price_456\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/subscriptions/upgrade',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"priceId\":\"price_456\"}\n)\ndata = response.json()"}]}},"/api/stripe/config":{"get":{"summary":"Get Stripe configuration","description":"Returns Stripe public configuration for client-side integration.","tags":["Subscriptions"],"security":[],"responses":{"200":{"description":"Stripe configuration","content":{"application/json":{"schema":{"type":"object","properties":{"publishableKey":{"type":"string"},"enabled":{"type":"boolean","description":"Whether this is enabled"}}},"examples":{"success":{"summary":"Successful response","value":{"publishableKey":"pk_live_xxxxxxxxxxxxx","plans":[{"id":"starter","name":"Starter","price":29,"interval":"month","features":["10 cases/month","Basic exports","Email support"]},{"id":"professional","name":"Professional","price":99,"interval":"month","features":["Unlimited cases","API access","Priority support"]}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getStripeConfig","x-public":true,"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/stripe/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/stripe/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/stripe/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/billing/signup-checkout/{signupId}":{"get":{"summary":"Start card-first signup checkout","description":"Card-first signup (only when CARD_FIRST_SIGNUP=true). Opened from the website after the signup form: looks up the lead and redirects to Stripe Checkout for a card-required free trial. An email that already has an account is sent to sign-in instead; unknown, malformed or stale leads go back to the signup form. The account itself is created by the Stripe webhook after checkout.","tags":["Subscriptions"],"security":[],"parameters":[{"name":"signupId","in":"path","required":true,"description":"Signup lead id (UUID) returned by the signup form handler.","schema":{"type":"string","format":"uuid"}}],"responses":{"303":{"description":"Redirect to Stripe Checkout, to sign-in for an existing account, or back to the signup form.","headers":{"Location":{"schema":{"type":"string","format":"uri"}}}},"404":{"description":"Card-first signup is not enabled."},"429":{"description":"Too many requests."}}}},"/api/billing/signup-checkout":{"post":{"summary":"Start checkout for a pending-payment user","description":"Card-first signup (only when CARD_FIRST_SIGNUP=true). For a signed-in user whose token carries only the pending_payment group (a new social sign-in): creates a Stripe Checkout session for the card-required free trial and returns its URL.","tags":["Subscriptions"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Checkout session created.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]}}}},"401":{"description":"Authentication required."},"409":{"description":"The user has no payment pending."},"429":{"description":"Too many requests."},"502":{"description":"Stripe Checkout unavailable."}}}},"/api/session/status":{"get":{"summary":"Get session status","description":"Returns the current session's status including idle time and expiration.","tags":["Session"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Session status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"session":{"$ref":"#/components/schemas/SessionInfo"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"authenticated":true,"user":{"id":"user_abc123","email":"user@example.com","name":"John Smith"},"expiresAt":"2025-01-15T18:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getSessionStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/session/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/session/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/session/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/session/list":{"get":{"summary":"List active sessions","description":"Returns all active sessions for the authenticated user.","tags":["Session"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of sessions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/SessionInfo"}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"sessions":[{"id":"sess_abc123","device":"Chrome on macOS","ip":"192.168.1.1","location":"San Francisco, CA","current":true,"createdAt":"2025-01-15T08:00:00Z","lastActiveAt":"2025-01-15T10:00:00Z"},{"id":"sess_def456","device":"Safari on iPhone","ip":"192.168.1.2","location":"San Francisco, CA","current":false,"createdAt":"2025-01-14T12:00:00Z","lastActiveAt":"2025-01-14T18:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getSessionList","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/session/list\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/session/list', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/session/list',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/session/logout":{"post":{"summary":"Logout current session","description":"Logs out and invalidates the current session.","tags":["Session"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Logged out","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"loggedOut":{"type":"boolean"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postSessionLogout","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/session/logout\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/session/logout', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/session/logout',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{}}}}}},"/api/session/terminate":{"post":{"summary":"Terminate session","description":"Terminates a specific session by ID. Can terminate other sessions.","tags":["Session"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","description":"Session ID to terminate"}},"required":["sessionId"]},"examples":{"default":{"summary":"Example request","value":{"sessionId":"sess_def456"}}}}}},"responses":{"200":{"description":"Session terminated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"terminated":{"type":"boolean"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Operation completed successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Session not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postSessionTerminate","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/session/terminate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"sessionId\":\"sess-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/session/terminate', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"sessionId\":\"sess-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/session/terminate',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"sessionId\":\"sess-123\"}\n)\ndata = response.json()"}]}},"/api/report/generate":{"post":{"summary":"Deprecated placeholder report endpoint","description":"Returns 410 because this endpoint never had a report worker. Use /api/v1/integrations/benefit-guides or the Proposal Book PDF/XLSX endpoints.","deprecated":true,"tags":["Reports"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"caseId":{"type":"string","description":"Case ID to generate report for"},"format":{"type":"string","enum":["pdf","docx","xlsx"],"default":"pdf","description":"Data format"},"template":{"type":"string","description":"Report template name"},"options":{"type":"object","description":"Additional report options"}},"required":["caseId"]},"examples":{"default":{"summary":"Example request","value":{"caseId":"case-acme-2025","type":"cost-comparison","options":{"includeProjections":true,"yearsToProject":3}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"},"example":{"ok":true,"reportId":"rpt_abc123","shareUrl":"https://reports.trybart.com/s/abc123","qrCodeDataUrl":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...","expiresAt":"2024-02-15T10:30:00Z"}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"202":{"description":"Report job queued","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"reportId":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","failed"],"description":"Current status"}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postReportGenerate","x-codeSamples":[{"lang":"curl","label":"cURL","source":"# Removed endpoint: POST /api/report/generate returns HTTP 410. Use /api/v1/integrations/benefit-guides or proposal-books endpoints."},{"lang":"javascript","label":"JavaScript","source":"// Removed endpoint: HTTP 410. Use versioned integration artifact endpoints."},{"lang":"python","label":"Python","source":"# Removed endpoint: HTTP 410. Use versioned integration artifact endpoints."}]}},"/api/report/status/{id}":{"get":{"summary":"Removed legacy report status endpoint","description":"Returns 410. /api/report/generate is deprecated and has no report worker.","deprecated":true,"tags":["Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Report status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"reportId":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","failed"],"description":"Current status"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"reportId":"rpt_xyz789","status":"completed","result":{"summary":{"currentTotalCost":1250000,"proposedTotalCost":1125000,"annualSavings":125000,"percentageSavings":10}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getReportStatusByid","x-codeSamples":[{"lang":"curl","label":"cURL","source":"# Removed endpoint: HTTP 410."},{"lang":"javascript","label":"JavaScript","source":"// Removed endpoint: HTTP 410."},{"lang":"python","label":"Python","source":"# Removed endpoint: HTTP 410."}]}},"/api/plans":{"get":{"summary":"List plans","description":"Retired process-local endpoint. Always returns 410. Use GET /api/v1/cases/{caseId}/plans.","tags":["Plans"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Legacy endpoint retired; use /api/v1/cases/{caseId}/plans.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"plans":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}}}},"examples":{"success":{"value":{"ok":true,"plans":[{"id":"plan-001","name":"PPO Gold","benefitType":"medical","carrier":"Aetna"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlans","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}],"deprecated":true,"x-api-lifecycle":"retired"},"post":{"summary":"Create a plan","description":"Retired process-local endpoint. Always returns 410. Use POST /api/v1/cases/{caseId}/plans.","tags":["Plans"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Plan"},"examples":{"default":{"value":{"name":"New PPO Plan","benefitType":"medical","carrier":"United Healthcare","benefits":{"deductible":{"value":"$1,000 / $2,000"}}}}}}}},"responses":{"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Legacy endpoint retired; use /api/v1/cases/{caseId}/plans.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"plan":{"$ref":"#/components/schemas/Plan"}}},"examples":{"success":{"value":{"ok":true,"plan":{"id":"plan-new-001","name":"New PPO Plan","benefitType":"medical","carrier":"United Healthcare","createdAt":"2025-01-15T10:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postPlans","deprecated":true,"x-api-lifecycle":"retired","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planName\":\"New Plan\",\"benefitType\":\"medical\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planName\":\"New Plan\",\"benefitType\":\"medical\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planName\":\"New Plan\",\"benefitType\":\"medical\"}\n)\ndata = response.json()"}]}},"/api/plans/{id}":{"get":{"summary":"Get plan by ID","description":"Retired process-local endpoint. Always returns 410. Use the case-scoped v1 plan route.","tags":["Plans"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"404":{"description":"Plan not found"},"410":{"description":"Legacy endpoint retired; use /api/v1/cases/{caseId}/plans/{planId}.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"plan":{"$ref":"#/components/schemas/Plan"}}},"examples":{"success":{"value":{"ok":true,"plan":{"id":"plan-001","name":"PPO Gold","benefitType":"medical","carrier":"Aetna","benefits":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"}}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanById","deprecated":true,"x-api-lifecycle":"retired","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plans/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plans/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update a plan","description":"Retired process-local endpoint. Always returns 410. Use the case-scoped v1 plan route.","tags":["Plans"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Plan"},"examples":{"update":{"value":{"name":"Updated PPO Gold","benefits":{"deductible":{"value":"$2,000 / $4,000"}}}}}}}},"responses":{"404":{"description":"Plan not found"},"410":{"description":"Legacy endpoint retired; use /api/v1/cases/{caseId}/plans/{planId}.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"plan":{"$ref":"#/components/schemas/Plan"}}},"examples":{"success":{"value":{"ok":true,"plan":{"id":"plan-001","name":"Updated PPO Gold","benefitType":"medical","updatedAt":"2025-01-15T11:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"putPlanById","deprecated":true,"x-api-lifecycle":"retired","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/plans/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planName\":\"Updated Plan\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planName\":\"Updated Plan\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/plans/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planName\":\"Updated Plan\"}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete a plan","description":"Retired process-local endpoint. Always returns 410. Use the case-scoped v1 plan route.","tags":["Plans"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"404":{"description":"Plan not found"},"410":{"description":"Legacy endpoint retired; use /api/v1/cases/{caseId}/plans/{planId}.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deletePlanById","deprecated":true,"x-api-lifecycle":"retired","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/plans/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/plans/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/status":{"get":{"summary":"Get trial status","description":"Returns the current user's trial status including remaining days, usage counts, and feature access.","tags":["Trial"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Trial status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"trial":{"type":"object","properties":{"isActive":{"type":"boolean"},"daysRemaining":{"type":"integer"},"startDate":{"type":"string","format":"date-time","description":"Start date"},"endDate":{"type":"string","format":"date-time","description":"End date"},"parseCount":{"type":"integer"},"parseLimit":{"type":"integer"},"exportCount":{"type":"integer"},"exportLimit":{"type":"integer"},"caseCount":{"type":"integer"},"caseLimit":{"type":"integer"}}}}},"examples":{"success":{"value":{"ok":true,"trial":{"isActive":true,"daysRemaining":7,"parseCount":5,"exportCount":2,"caseCount":3}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getTrialStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/validate-action":{"post":{"summary":"Validate trial action","description":"Checks if the user can perform a specific action based on their trial limits.","tags":["Trial"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["parse","export","createCase","aiAssist"]}},"required":["action"]},"examples":{"default":{"value":{"action":"parse"}}}}}},"responses":{"200":{"description":"Action validation result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"allowed":{"type":"boolean"},"reason":{"type":"string","description":"Explanation or reason text"},"remaining":{"type":"integer","description":"Remaining amount/count"},"limit":{"type":"integer","description":"Maximum limit"}}},"examples":{"allowed":{"value":{"ok":true,"allowed":true,"remaining":20,"limit":25}},"blocked":{"value":{"ok":true,"allowed":false,"reason":"Parse limit exceeded","remaining":0,"limit":25}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postTrialValidateAction","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/validate-action\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"action\":\"create_case\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/validate-action', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"action\":\"create_case\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/validate-action',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"action\":\"create_case\"}\n)\ndata = response.json()"}]}},"/api/costing/estimate":{"post":{"summary":"Estimate costs","description":"Calculates cost estimates for plan comparisons including employer contributions and employee costs.","tags":["Costing"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}},"enrollmentTiers":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentTier"}},"contributionSettings":{"$ref":"#/components/schemas/ContributionSettings"}}},"examples":{"default":{"value":{"plans":[{"id":"plan-1","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650},"family":{"enrolled":30,"rate":1800}}}],"contributionSettings":{"isEnabled":true,"frequency":24,"modelType":"tiered","models":{"global":{"employee":{"type":"%","value":75}}}}}}}}}},"responses":{"200":{"description":"Cost estimates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"estimates":{"type":"object","additionalProperties":{"type":"object","properties":{"totalAnnualCost":{"type":"number"},"employerAnnualCost":{"type":"number"},"employeeAnnualCost":{"type":"number"},"perEmployeeCost":{"type":"number"}}}}}},"examples":{"success":{"value":{"ok":true,"estimates":{"plan-1":{"totalAnnualCost":1248000,"employerAnnualCost":936000,"employeeAnnualCost":312000,"perEmployeeCost":15600}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postCostingEstimate","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/estimate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[{\"id\":\"plan-1\",\"enrollmentAndRates\":{\"employee\":{\"enrolled\":50,\"rate\":650}}}]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/estimate', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    plans: [{\n      id: 'plan-1',\n      enrollmentAndRates: { employee: { enrolled: 50, rate: 650 } }\n    }],\n    contributionSettings: { isEnabled: true, frequency: 24 }\n  })\n});\nconst { estimates } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/estimate',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\n        'plans': [{'id': 'plan-1', 'enrollmentAndRates': {'employee': {'enrolled': 50, 'rate': 650}}}],\n        'contributionSettings': {'isEnabled': True, 'frequency': 24}\n    }\n)\nestimates = response.json()['estimates']"}],"x-rateLimit":{"limit":30,"window":"1m","description":"Cost calculations are computationally intensive"}}},"/api/invitations/accept":{"post":{"summary":"Accept organization invitation","description":"Deprecated compatibility alias. Use POST /api/organizations/accept.","deprecated":true,"tags":["Invitations"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Invitation token"}},"required":["token"]},"examples":{"default":{"value":{"token":"inv_abc123xyz"}}}}}},"responses":{"200":{"description":"Invitation accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"role":{"type":"string","description":"User role (owner, admin, member)"}}}}},"examples":{"success":{"value":{"ok":true,"organization":{"id":"org_xyz789","name":"Benefits Consulting Group","role":"member"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid or expired token"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"postInvitationsAccept","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/invitations/accept\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"token\":\"inv_abc123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/invitations/accept', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"token\":\"inv_abc123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/invitations/accept',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"token\":\"inv_abc123\"}\n)\ndata = response.json()"}]}},"/api/ai/providers/status":{"get":{"summary":"Get AI provider status","description":"Returns the status and availability of configured AI providers.","tags":["AI"],"responses":{"200":{"description":"AI provider status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"providers":{"type":"object","additionalProperties":{"type":"object","properties":{"available":{"type":"boolean","description":"Whether available"},"name":{"type":"string","description":"Display name"},"models":{"type":"array","items":{"type":"string"}}}},"description":"Available providers"}}},"examples":{"success":{"value":{"ok":true,"providers":{"openai":{"available":true,"name":"OpenAI","models":["gpt-4","gpt-4-turbo","gpt-3.5-turbo"]},"anthropic":{"available":true,"name":"Anthropic","models":["claude-3-opus","claude-3-sonnet"]},"azure":{"available":false,"name":"Azure OpenAI"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAiProvidersStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/ai/providers/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/providers/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/ai/providers/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/ai/plan-recommendations/status":{"get":{"summary":"Get plan recommendations status","description":"Returns the status and configuration of the AI plan recommendations feature.","tags":["AI"],"responses":{"200":{"description":"Recommendations status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"enabled":{"type":"boolean","description":"Whether this is enabled"},"model":{"type":"string"},"lastUpdated":{"type":"string","format":"date-time"}}},"examples":{"success":{"value":{"ok":true,"enabled":true,"model":"gpt-4-turbo","lastUpdated":"2025-01-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAiPlanRecommendationsStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/ai/plan-recommendations/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/plan-recommendations/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/ai/plan-recommendations/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/azure/cu/configured":{"get":{"summary":"Check Azure Document Intelligence configuration","description":"Returns whether Azure Document Intelligence (formerly Custom Units) is configured.","tags":["Azure"],"responses":{"200":{"description":"Configuration status","content":{"application/json":{"schema":{"type":"object","properties":{"configured":{"type":"boolean","description":"Whether integration is configured"},"endpoint":{"type":"string","description":"API endpoint"},"region":{"type":"string","description":"AWS region"}}},"examples":{"configured":{"value":{"configured":true,"endpoint":"https://xxx.cognitiveservices.azure.com","region":"eastus"}},"notConfigured":{"value":{"configured":false}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAzureCuConfigured","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/azure/cu/configured\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/azure/cu/configured', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/azure/cu/configured',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/azure/cu/poll":{"get":{"summary":"Poll Azure Document Intelligence operation","description":"Polls for the status of an ongoing Azure Document Intelligence operation.","tags":["Azure"],"parameters":[{"name":"operationId","in":"query","required":true,"schema":{"type":"string"},"description":"The operation ID to poll"}],"responses":{"200":{"description":"Operation status","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["running","succeeded","failed"],"description":"Current status"},"progress":{"type":"integer"},"result":{"type":"object","description":"Operation result"}}},"examples":{"running":{"value":{"status":"running","progress":50}},"succeeded":{"value":{"status":"succeeded","progress":100,"result":{"pages":3,"tables":2}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAzureCuPoll","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/azure/cu/poll\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/azure/cu/poll', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/azure/cu/poll',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/analytics/session/start":{"post":{"summary":"Start analytics session","description":"Records the start of a user session for analytics tracking.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","description":"Data source"},"referrer":{"type":"string"},"userAgent":{"type":"string"}}},"examples":{"default":{"value":{"source":"direct","userAgent":"Mozilla/5.0..."}}}}}},"responses":{"200":{"description":"Session started","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"sessionId":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"sessionId":"sess_abc123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAnalyticsSessionStart","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/analytics/session/start\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"sessionId\":\"sess-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/analytics/session/start', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"sessionId\":\"sess-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/analytics/session/start',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"sessionId\":\"sess-123\"}\n)\ndata = response.json()"}]}},"/api/analytics/session/end":{"post":{"summary":"End analytics session","description":"Records the end of a user session.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"}},"required":["sessionId"]},"examples":{"default":{"value":{"sessionId":"sess_abc123"}}}}}},"responses":{"200":{"description":"Session ended","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAnalyticsSessionEnd","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/analytics/session/end\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"sessionId\":\"sess-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/analytics/session/end', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"sessionId\":\"sess-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/analytics/session/end',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"sessionId\":\"sess-123\"}\n)\ndata = response.json()"}]}},"/api/analytics/funnel/event":{"post":{"summary":"Track funnel event","description":"Records a user event in the conversion funnel.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string"},"step":{"type":"string"},"metadata":{"type":"object","description":"Additional metadata"}},"required":["event"]},"examples":{"default":{"value":{"event":"case_created","step":"onboarding","metadata":{"caseId":"case-123"}}}}}}},"responses":{"200":{"description":"Event recorded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAnalyticsFunnelEvent","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/analytics/funnel/event\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"funnel\":\"case_creation\",\"step\":\"start\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/analytics/funnel/event', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"funnel\":\"case_creation\",\"step\":\"start\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/analytics/funnel/event',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"funnel\":\"case_creation\",\"step\":\"start\"}\n)\ndata = response.json()"}]}},"/api/config":{"get":{"summary":"Get application configuration","description":"Returns public application configuration including feature flags and API endpoints.","tags":["System"],"responses":{"200":{"description":"Application configuration","content":{"application/json":{"schema":{"type":"object","properties":{"features":{"type":"object","additionalProperties":{"type":"boolean"}},"endpoints":{"type":"object","properties":{"api":{"type":"string"},"ws":{"type":"string"}}},"version":{"type":"string","description":"Version number"}}},"examples":{"success":{"value":{"features":{"aiAssist":true,"exportToPdf":true,"teamSharing":true},"endpoints":{"api":"https://b3wdmzbgps.us-east-1.awsapprunner.com","ws":"wss://b3wdmzbgps.us-east-1.awsapprunner.com"},"version":"1.0.0"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getConfig","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/usage/events":{"get":{"summary":"Get usage events","description":"Returns recent usage events for the authenticated user.","tags":["System"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":100},"description":"Maximum number of results to return"},{"name":"type","in":"query","schema":{"type":"string"},"description":"Filter by event type"}],"responses":{"200":{"description":"Usage events","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"type":{"type":"string","description":"Resource type"},"timestamp":{"type":"string","format":"date-time","description":"Event timestamp"},"metadata":{"type":"object","description":"Additional metadata"}}},"description":"Event records"}}},"examples":{"success":{"value":{"ok":true,"events":[{"id":"evt-001","type":"parse","timestamp":"2025-01-15T10:00:00Z"},{"id":"evt-002","type":"export","timestamp":"2025-01-15T09:30:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getUsageEvents","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/usage/events\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/usage/events', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/usage/events',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/usage/event":{"post":{"summary":"Record usage event","description":"Records a usage event for analytics and quota tracking.","tags":["System"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","description":"Resource type"},"metadata":{"type":"object","description":"Additional metadata"}},"required":["type"]},"examples":{"default":{"value":{"type":"parse","metadata":{"pages":3}}}}}}},"responses":{"200":{"description":"Event recorded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postUsageEvent","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/usage/event\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"event\":\"page_view\",\"page\":\"/dashboard\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/usage/event', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"event\":\"page_view\",\"page\":\"/dashboard\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/usage/event',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"event\":\"page_view\",\"page\":\"/dashboard\"}\n)\ndata = response.json()"}]}},"/api/ai/chat":{"post":{"summary":"AI chat completion","description":"Send a message to the AI assistant for benefits analysis help.","tags":["AI"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","description":"Response or status message"},"context":{"type":"object"},"model":{"type":"string"}},"required":["message"]},"examples":{"default":{"value":{"message":"What are typical deductible ranges for small group medical plans?","context":{"caseId":"case-123"}}}}}}},"responses":{"200":{"description":"AI response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"response":{"type":"string","description":"Response data"},"usage":{"type":"object","properties":{"promptTokens":{"type":"integer"},"completionTokens":{"type":"integer"}},"description":"Usage data"}}},"examples":{"success":{"value":{"ok":true,"response":"For small group medical plans, typical deductible ranges are...","usage":{"promptTokens":50,"completionTokens":150}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAiChat","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/chat\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"message\":\"What are typical deductibles for tech companies?\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/chat', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    message: 'What are typical deductibles for tech companies?',\n    context: { caseId: 'case-123' }\n  })\n});\nconst { response: aiResponse } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/chat',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\n        'message': 'What are typical deductibles for tech companies?',\n        'context': {'caseId': 'case-123'}\n    }\n)\nai_response = response.json()['response']"}],"x-rateLimit":{"limit":20,"window":"1m","description":"AI chat uses LLM resources"}}},"/api/ai/plan-recommendations":{"post":{"summary":"Get AI plan recommendations","description":"Get AI-powered plan recommendations based on current case data.","tags":["AI"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"caseId":{"type":"string","description":"Associated case ID"},"criteria":{"type":"object","properties":{"budget":{"type":"string"},"priorities":{"type":"array","items":{"type":"string"}}}}},"required":["caseId"]},"examples":{"default":{"value":{"caseId":"case-acme-2025","criteria":{"budget":"maintain","priorities":["lower-deductibles","broader-network"]}}}}}}},"responses":{"200":{"description":"Plan recommendations","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"recommendations":{"type":"array","items":{"type":"object","properties":{"planId":{"type":"string","description":"Associated plan ID"},"score":{"type":"number","description":"Calculated score"},"rationale":{"type":"string"}}},"description":"Recommendations"}}},"examples":{"success":{"value":{"ok":true,"recommendations":[{"planId":"plan-proposed-1","score":0.92,"rationale":"Best match for budget and network requirements"},{"planId":"plan-proposed-2","score":0.85,"rationale":"Lower deductibles but slightly higher premium"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAiPlanRecommendations","x-rateLimit":{"limit":10,"window":"1m","description":"AI recommendations use LLM resources"},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/plan-recommendations\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\",\"preferences\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/plan-recommendations', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\",\"preferences\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/plan-recommendations',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\",\"preferences\":{}}\n)\ndata = response.json()"}]}},"/api/cases/{id}/share":{"get":{"summary":"Get case sharing settings","description":"Returns the current sharing configuration for a case.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Sharing settings","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"sharing":{"type":"object","properties":{"isShared":{"type":"boolean"},"sharedWith":{"type":"array","items":{"type":"string"}},"visibility":{"type":"string","description":"Visibility setting (private, org, shared)"}},"description":"Sharing capability supported"}}},"examples":{"success":{"value":{"ok":true,"sharing":{"isShared":true,"sharedWith":["org_xyz789"],"visibility":"org"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found"}}},"example":{"ok":false,"error":"not_found","message":"Resource not found"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getCaseShare","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/share\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/share', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/share',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Update case sharing","description":"Updates the sharing configuration for a case.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visibility":{"type":"string","enum":["private","org","shared"],"description":"Visibility setting (private, org, shared)"},"sharedWith":{"type":"array","items":{"type":"string"}}}},"examples":{"default":{"value":{"visibility":"org","sharedWith":["org_xyz789"]}}}}}},"responses":{"200":{"description":"Sharing updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found"}}},"example":{"ok":false,"error":"not_found","message":"Resource not found"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postCaseShare","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases/EXAMPLE_ID/share\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"user@example.com\",\"permissions\":[\"view\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/share', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"email\":\"user@example.com\",\"permissions\":[\"view\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/share',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"email\":\"user@example.com\",\"permissions\":[\"view\"]}\n)\ndata = response.json()"}]}},"/api/trial/check-ai-credits":{"get":{"summary":"Check AI credits remaining","description":"Returns the number of AI credits remaining for the current user.","tags":["Trial"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"AI credits status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"remaining":{"type":"integer","description":"Remaining amount/count"},"limit":{"type":"integer","description":"Maximum limit"},"resetsAt":{"type":"string","format":"date-time"}}},"examples":{"success":{"value":{"ok":true,"remaining":45,"limit":100,"resetsAt":"2025-02-01T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getTrialCheckAiCredits","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/check-ai-credits\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/check-ai-credits', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/check-ai-credits',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/watermark-config":{"get":{"summary":"Get watermark configuration","description":"Returns watermark settings for trial exports.","tags":["Trial"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Watermark configuration","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"enabled":{"type":"boolean","description":"Whether this is enabled"},"text":{"type":"string","description":"Text content to parse"},"opacity":{"type":"number"}}},"examples":{"trial":{"value":{"ok":true,"enabled":true,"text":"TRIAL VERSION","opacity":0.3}},"paid":{"value":{"ok":true,"enabled":false}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getTrialWatermarkConfig","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/watermark-config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/watermark-config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/watermark-config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/azure/credentials":{"get":{"summary":"Get Azure credentials status","description":"Check if Azure Document Intelligence credentials are configured.","tags":["Azure"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Credentials status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"configured":{"type":"boolean","description":"Whether integration is configured"},"endpoint":{"type":"string","description":"API endpoint"}}},"examples":{"success":{"value":{"ok":true,"configured":true,"endpoint":"https://xxx.cognitiveservices.azure.com"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getAzureCredentials","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/azure/credentials\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/azure/credentials', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/azure/credentials',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Update Azure credentials","description":"Configure Azure Document Intelligence credentials.","tags":["Azure"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"endpoint":{"type":"string","description":"API endpoint"},"key":{"type":"string","description":"Unique key identifier"}},"required":["endpoint","key"]},"examples":{"default":{"value":{"endpoint":"https://myservice.cognitiveservices.azure.com","key":"your-api-key"}}}}}},"responses":{"200":{"description":"Credentials updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"}}},"examples":{"success":{"value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"postAzureCredentials","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/azure/credentials\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"endpoint\":\"https://...\",\"apiKey\":\"key\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/azure/credentials', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"endpoint\":\"https://...\",\"apiKey\":\"key\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/azure/credentials',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"endpoint\":\"https://...\",\"apiKey\":\"key\"}\n)\ndata = response.json()"}]}},"/api/web-reports/generate":{"post":{"summary":"Generate a shareable web report","description":"Creates a new shareable web report and returns a public URL. The report is stored in S3 and can be accessed without authentication. Ideal for sharing benefit summaries with clients or embedding in external applications.\n\n**Use Cases:**\n- Share benefit analysis with clients via link\n- Embed reports in CRM systems (Salesforce, HubSpot)\n- Generate QR codes for printed materials\n- Create time-limited shareable links","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reportData"],"properties":{"caseId":{"type":"string","description":"Case ID to associate with the report (for tracking)"},"tab":{"type":"string","description":"Report tab/section identifier"},"reportData":{"type":"object","description":"Report content data","required":["employerName"],"properties":{"employerName":{"type":"string","description":"Company/employer name for the report header"},"effectiveDate":{"type":"string","description":"Effective date for the benefits"},"plans":{"type":"array","description":"Array of benefit plans to include","items":{"type":"object","properties":{"planName":{"type":"string","description":"Plan display name"},"planType":{"type":"string","description":"Plan type classification"},"carrier":{"type":"string","description":"Insurance carrier name"},"rates":{"type":"object"},"benefits":{"type":"object","description":"Benefit details map"}}}},"summary":{"type":"object","description":"Summary metrics and KPIs"}}},"capturedHtml":{"type":"string","description":"Pre-rendered HTML content (optional, for pixel-perfect exports)"},"options":{"type":"object","properties":{"expirationDays":{"type":"integer","default":30,"description":"Days until the link expires (1-365)"},"watermark":{"type":"object","properties":{"showWatermark":{"type":"boolean"},"text":{"type":"string","description":"Text content to parse"}}},"branding":{"type":"object","properties":{"logo":{"type":"string","format":"uri"},"companyName":{"type":"string"},"primaryColor":{"type":"string"}}},"theme":{"type":"object","properties":{"accent":{"type":"string","description":"Accent color (hex)"}}}},"description":"Available options"}}},"examples":{"basic":{"summary":"Basic report generation","value":{"caseId":"case-acme-2025","reportData":{"employerName":"Acme Corporation","effectiveDate":"2025-01-01","plans":[{"planName":"PPO Gold","planType":"Medical","carrier":"Blue Cross","rates":{"employee":450,"family":1200}}]},"options":{"expirationDays":30}}},"request":{"summary":"Generate a new web report","value":{"caseId":"case_abc123","title":"Acme Corp 2025 Benefit Analysis","reportType":"benefit-guide","expiresInDays":90}}}}}},"responses":{"200":{"description":"Report generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Whether the operation succeeded"},"reportId":{"type":"string","description":"Unique report identifier","example":"GQHqYBdunPQKXdBKVrRBbA"},"shareUrl":{"type":"string","format":"uri","description":"Public URL to view the report","example":"https://app.trybart.com/r/GQHqYBdunPQKXdBKVrRBbA"},"qrDataUrl":{"type":"string","description":"Base64-encoded QR code image (data URI)"},"expiresAt":{"type":"string","format":"date-time","description":"When the report link expires"},"metadataSaved":{"type":"boolean","description":"Whether report metadata was saved to database"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"reportId":"wr_abc123xyz","url":"https://reports.trybart.com/wr_abc123xyz","expiresAt":"2025-02-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request - missing reportData"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Trial limit exceeded"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Report generation failed"}},"operationId":"generateWebReport","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/web-reports/generate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\",\"template\":\"executive-summary\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/generate', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\n    caseId: 'case-123',\n    template: 'executive-summary'\n  })\n});\nconst { reportId, url } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/web-reports/generate',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={'caseId': 'case-123', 'template': 'executive-summary'}\n)\nreport = response.json()"}],"x-rateLimit":{"limit":10,"window":"1m","description":"Report generation is resource-intensive"}}},"/api/web-reports/published-artifacts/{linkId}/history":{"get":{"summary":"List immutable revisions for a hosted artifact","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"linkId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Hosted artifact revision history"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this artifact"},"404":{"description":"Artifact not found"}},"operationId":"listPublishedArtifactHistory"}},"/api/web-reports/published-artifacts/{linkId}/history/{version}/preview":{"get":{"summary":"Create a short-lived preview URL for a hosted artifact revision","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"linkId","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Five-minute signed preview URL"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this artifact"},"404":{"description":"Revision not found"}},"operationId":"previewPublishedArtifactVersion"}},"/api/web-reports/published-artifacts/{linkId}/history/{version}/restore":{"post":{"summary":"Restore a hosted artifact revision as a new latest revision","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"linkId","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v3\""}}],"responses":{"201":{"description":"Revision restored as a new latest version"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this artifact"},"404":{"description":"Revision not found"},"412":{"description":"Current revision no longer matches If-Match"},"428":{"description":"If-Match header required"}},"operationId":"restorePublishedArtifactVersion"}},"/api/web-reports/{reportId}/history":{"get":{"summary":"List immutable revisions for a shared report","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Shared report revision history"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this report"},"404":{"description":"Report not found"}},"operationId":"listSharedReportHistory"}},"/api/web-reports/{reportId}/history/{version}/preview":{"get":{"summary":"Create a short-lived preview URL for a shared report revision","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Five-minute signed preview URL"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this report"},"404":{"description":"Revision not found"}},"operationId":"previewSharedReportVersion"}},"/api/web-reports/{reportId}/history/{version}/restore":{"post":{"summary":"Restore a shared report revision as a new latest revision","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v3\""}}],"responses":{"201":{"description":"Revision restored as a new latest version"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller does not own this report"},"404":{"description":"Revision not found"},"412":{"description":"Current revision no longer matches If-Match"},"428":{"description":"If-Match header required"}},"operationId":"restoreSharedReportVersion"}},"/api/web-reports/republish-guide":{"post":{"summary":"Republish a benefit guide","description":"Overwrites an existing published BenefitGuideV2 guide in place, preserving the short code and public guide URL.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v1\""}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["linkId","html"],"properties":{"linkId":{"type":"string","description":"Existing guide link id"},"html":{"type":"string","description":"Rendered guide HTML"},"vm":{"type":"object","nullable":true,"description":"Optional view-model snapshot to persist with the guide"},"title":{"type":"string","description":"Optional guide title"}}}}}},"responses":{"200":{"description":"Guide republished","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"shortCode":{"type":"string"},"shareUrl":{"type":"string"},"shortUrl":{"type":"string"},"kind":{"type":"string","example":"benefit-guide"}}}}}},"400":{"description":"Missing or invalid guide HTML"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not own the guide link"},"404":{"description":"Guide link not found"},"409":{"description":"Guide link is missing its S3 key"},"413":{"description":"Guide HTML is too large"},"503":{"description":"Link service unavailable"}},"operationId":"republishBenefitGuide"}},"/api/web-reports/republish-artifact":{"post":{"summary":"Republish a hosted proposal artifact","description":"Overwrites an existing published proposal artifact (Proposal Book or Presentation) in place, preserving the short code and public artifact URL. The client re-renders and sends fresh HTML.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v1\""}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["linkId","kind","html"],"properties":{"linkId":{"type":"string","description":"Existing hosted artifact link id"},"kind":{"type":"string","enum":["proposal-book","presentation"],"description":"Artifact kind. Must match the kind the link was minted with."},"html":{"type":"string","description":"Rendered artifact HTML. Must contain a closing body tag."},"vm":{"type":"object","nullable":true,"description":"Optional view-model snapshot persisted alongside the artifact for future re-render"},"title":{"type":"string","description":"Optional artifact title"},"themeId":{"type":"string","nullable":true,"description":"Optional theme identifier stamped into the artifact snapshot"}}}}}},"responses":{"200":{"description":"Artifact republished","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"shortCode":{"type":"string"},"shareUrl":{"type":"string","example":"/book/ab12cd"},"shortUrl":{"type":"string"},"kind":{"type":"string","enum":["proposal-book","presentation"],"example":"proposal-book"}}}}}},"400":{"description":"Missing linkId, unknown artifact kind, or missing/invalid artifact HTML"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not own the artifact link"},"404":{"description":"Artifact link not found, or its kind does not match the requested kind"},"409":{"description":"Artifact link is missing its S3 key"},"413":{"description":"Artifact HTML is too large"},"500":{"description":"Artifact upload to storage failed"},"503":{"description":"Link service unavailable"}},"operationId":"republishHostedArtifact"}},"/api/hosted-artifacts/links":{"get":{"summary":"List hosted artifact links for a case","description":"Case-scoped lookup of the caller's published proposal artifact links, powering the update-existing-link vs. publish-new choice in the hosted share panel. Fails closed: an unidentified caller or a lookup failure returns an empty list rather than an error or another user's links.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"query","required":true,"schema":{"type":"string"},"description":"Case whose artifact links should be listed"},{"name":"kind","in":"query","required":true,"schema":{"type":"string","enum":["proposal-book","presentation"]},"description":"Artifact kind to filter by. Internal link kinds (book, deck) are rejected."}],"responses":{"200":{"description":"Artifact links owned by the caller for this case. Empty when the caller cannot be identified or the lookup fails.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"links":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"shortCode":{"type":"string"},"createdAt":{"type":"string","format":"date-time","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true},"viewCount":{"type":"integer"}}}}}}}}},"400":{"description":"Missing caseId (case_id_required) or unknown artifact kind (artifact_kind_invalid)"},"401":{"$ref":"#/components/responses/Unauthorized"}},"operationId":"listHostedArtifactLinks"}},"/guide/{code}":{"get":{"summary":"Open published benefit guide","description":"Public benefit guide short-link route. Redirects to a presigned guide URL when available, or returns a generic unavailable HTML page.","tags":["Web Reports"],"security":[],"parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"},"description":"Published guide short code"}],"responses":{"200":{"description":"Generic unavailable HTML for expired guide links","content":{"text/html":{"schema":{"type":"string"}}}},"302":{"description":"Redirect to presigned guide URL"},"404":{"description":"Generic unavailable HTML for missing or inaccessible guide links","content":{"text/html":{"schema":{"type":"string"}}}}},"operationId":"getPublishedBenefitGuide"}},"/api/v1/documents/{id}/extend":{"patch":{"summary":"Extend document expiration","description":"Extends a document library item's expiration date for the authenticated user. For slug-backed SBC links, the linked public expiration is mirrored when possible.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Document id"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"extendDays":{"type":"integer","minimum":1,"maximum":180,"default":30,"description":"Number of days from now to set as the new expiration"}}}}}},"responses":{"200":{"description":"Expiration extended","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"expiresAt":{"type":"integer","description":"New expiration timestamp in milliseconds"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User cannot access the document"},"404":{"description":"Document not found"},"500":{"description":"Expiration extension failed"}},"operationId":"extendDocumentExpiration"}},"/api/v1/rag/source/{chunkId}":{"get":{"summary":"Get RAG source document URL","description":"Returns a short-lived signed URL for a case RAG source document chunk owned by the authenticated user.","tags":["RAG"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"chunkId","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"RAG case chunk id"}],"responses":{"200":{"description":"Signed source document URL","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"page":{"type":"integer","nullable":true},"filename":{"type":"string"},"expiresIn":{"type":"integer","example":300}}}}}},"400":{"description":"Invalid chunk id"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Source document not found"},"500":{"description":"Source lookup or signing failed"}},"operationId":"getRagSourceDocument"}},"/api/v1/rag/feedback":{"post":{"summary":"Submit RAG feedback","description":"Stores up/down feedback for one or more RAG query event ids owned by the authenticated user.","tags":["RAG"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"oneOf":[{"type":"string","enum":["up","down"]},{"type":"integer","enum":[1,-1]}]},"eventId":{"type":"integer","minimum":1},"eventIds":{"type":"array","maxItems":4,"items":{"type":"integer","minimum":1}}},"required":["rating"]}}}},"responses":{"200":{"description":"Feedback stored","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"updated":{"type":"integer"}}}}}},"400":{"description":"Rating and event id are required"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Feedback update failed"}},"operationId":"submitRagFeedback"}},"/api/web-reports/{reportId}":{"get":{"summary":"View a shared web report","description":"Retrieves the HTML content of a shared report. This is a **public endpoint** - no authentication required. Returns the full HTML page ready for browser rendering.","tags":["Web Reports"],"security":[],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"Report ID from the shareUrl","example":"GQHqYBdunPQKXdBKVrRBbA"}],"responses":{"200":{"description":"Report HTML content","content":{"text/html":{"schema":{"type":"string"},"example":"<!DOCTYPE html><html><head><title>Benefits Report - Acme Corp</title></head><body><!-- Full rendered report HTML --></body></html>"}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid report ID format"},"404":{"description":"Report not found"},"410":{"description":"Report has expired"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getWebReport","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"delete":{"summary":"Delete a shared web report","description":"Soft delete a shared web report. Only the report owner can delete it. The report will no longer be accessible via its share URL after deletion.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{20,24}$"},"description":"The unique report identifier (base64url encoded)","example":"GQHqYBdunPQKXdBKVrRBbA"}],"responses":{"200":{"description":"Report deleted successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","message"],"properties":{"ok":{"type":"boolean","example":true},"message":{"type":"string","example":"Report deleted successfully"}}},"examples":{"success":{"summary":"Report deleted successfully","value":{"ok":true,"message":"Report deleted successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found or user lacks permission","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Report not found or you do not have permission to delete it"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"delete_failed"},"message":{"type":"string","example":"Failed to delete report"}}}}}}},"operationId":"deleteWebReport","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/web-reports/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/meta":{"get":{"summary":"Get report metadata","description":"Retrieves metadata about a web report including creation date, expiration, and view statistics.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"Report ID"}],"responses":{"200":{"description":"Report metadata","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"reportId":{"type":"string"},"shareUrl":{"type":"string","format":"uri"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"expiresAt":{"type":"string","format":"date-time","description":"Expiration timestamp"},"viewCount":{"type":"integer"},"lastViewedAt":{"type":"string","format":"date-time"},"caseId":{"type":"string","description":"Associated case ID"},"reportTitle":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"reportId":"wr_abc123xyz","caseId":"case-acme-2025","createdAt":"2025-01-15T10:00:00Z","expiresAt":"2025-02-15T00:00:00Z","viewCount":45,"isLive":true,"template":"executive-summary"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getWebReportMeta","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/meta\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/meta', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/meta',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/email":{"post":{"summary":"Email a report link","description":"Sends the report share link via email to a recipient. Includes an optional personal message and QR code.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"Report ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to"],"properties":{"to":{"type":"string","format":"email","description":"Recipient email address"},"subject":{"type":"string","description":"Custom email subject (optional)"},"message":{"type":"string","description":"Personal message to include in the email"},"attachments":{"type":"array","items":{"type":"string","enum":["pdf","pptx","xlsx"]},"description":"Export formats to attach (future feature)"}}},"examples":{"basic":{"value":{"to":"client@example.com","message":"Please review the attached benefits summary."}}}}}},"responses":{"200":{"description":"Email sent successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Whether the operation succeeded"},"message":{"type":"string","example":"Report sent successfully","description":"Response or status message"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"sentTo":["client@company.com","cfo@company.com"],"messageId":"msg_xyz789"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid email address"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Email service unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false,"description":"Whether the operation succeeded"},"error":{"type":"string","example":"email_not_configured","description":"Error message if failed"},"message":{"type":"string","example":"Email service is not available. Please copy the link manually.","description":"Response or status message"}}}}}}},"operationId":"emailWebReport","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/email\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"to\":\"client@example.com\",\"subject\":\"Benefits Report\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/email', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"to\":\"client@example.com\",\"subject\":\"Benefits Report\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/email',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"to\":\"client@example.com\",\"subject\":\"Benefits Report\"}\n)\ndata = response.json()"}]}},"/api/web-reports/list/my-reports":{"get":{"summary":"List your shared reports","description":"Returns a list of web reports created by the authenticated user, with pagination support.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":20,"maximum":100},"description":"Maximum number of reports to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of reports to skip (for pagination)"}],"responses":{"200":{"description":"List of reports","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Whether the operation succeeded"},"reports":{"type":"array","items":{"type":"object","properties":{"reportId":{"type":"string"},"shareUrl":{"type":"string","format":"uri"},"reportTitle":{"type":"string"},"caseId":{"type":"string","description":"Associated case ID"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"expiresAt":{"type":"string","format":"date-time","description":"Expiration timestamp"},"viewCount":{"type":"integer"}}}},"total":{"type":"integer","description":"Total number of reports"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"reports":[{"reportId":"wr_abc123xyz","caseId":"case-acme-2025","employerName":"Acme Corporation","createdAt":"2025-01-15T10:00:00Z","viewCount":45,"isLive":true},{"reportId":"wr_def456uvw","caseId":"case-widgets-2025","employerName":"Widgets Inc","createdAt":"2025-01-10T09:00:00Z","viewCount":12,"isLive":false}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listMyWebReports","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/list/my-reports\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/list/my-reports', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/list/my-reports',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/ai/market/compare-benefits":{"post":{"summary":"Compare benefits against market","description":"Compare plan benefits against market benchmarks.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"comparison":{"type":"object","additionalProperties":true},"timestamp":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"comparison":{"deductible":{"value":1500,"marketAvg":2100,"position":"better"}},"timestamp":"2025-01-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_ai_market_comparebenefits","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["planId"],"properties":{"planId":{"type":"string"},"targetIndustry":{"type":"string"},"targetLocation":{"type":"string"},"benefitTypes":{"type":"array","items":{"type":"string"}}}},"examples":{"default":{"summary":"Example request","value":{"planId":"plan-1","targetIndustry":"technology","targetLocation":"california"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/market/compare-benefits\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planIds\":[\"plan1\",\"plan2\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/market/compare-benefits', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planIds\":[\"plan1\",\"plan2\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/market/compare-benefits',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planIds\":[\"plan1\",\"plan2\"]}\n)\ndata = response.json()"}]}},"/api/ai/market/competitive-position":{"post":{"summary":"Analyze competitive position","description":"Analyze the competitive position of current plans against market.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"position":{"type":"object","properties":{"overall":{"type":"string"},"percentile":{"type":"integer"},"strengths":{"type":"array","items":{"type":"string"}},"weaknesses":{"type":"array","items":{"type":"string"}}}},"timestamp":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"position":{"overall":"above-average","percentile":72,"strengths":["Competitive deductibles"]},"timestamp":"2025-01-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_ai_market_competitiveposition","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currentPlans":{"type":"array","items":{"type":"object"}},"targetMarket":{"type":"object"}}},"examples":{"default":{"summary":"Example request","value":{"currentPlans":[{"id":"plan-1"}],"targetMarket":{"industry":"technology"}}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/market/competitive-position\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/market/competitive-position', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/market/competitive-position',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/ai/market/industry-trends":{"post":{"summary":"Get industry benefit trends","description":"Get current benefit trends for a specific industry.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"trends":{"type":"array","items":{"type":"object","properties":{"trend":{"type":"string"},"direction":{"type":"string"},"change":{"type":"string"},"insight":{"type":"string"}}}},"timestamp":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"trends":[{"trend":"HDHP Adoption","direction":"increasing","change":"+12% YoY"}],"timestamp":"2025-01-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_ai_market_industrytrends","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"industry":{"type":"string"},"location":{"type":"string"},"timeframe":{"type":"string"}}},"examples":{"default":{"summary":"Example request","value":{"industry":"technology","location":"nationwide"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/market/industry-trends\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"industry\":\"technology\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/market/industry-trends', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"industry\":\"technology\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/market/industry-trends',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"industry\":\"technology\"}\n)\ndata = response.json()"}]}},"/api/ai/memory":{"get":{"summary":"Get AI memory items","description":"Retrieve AI conversation memory items for a session.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"items":{"type":"array","items":{"type":"object","properties":{"ts":{"type":"integer"},"text":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}}}}},"count":{"type":"integer"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"items":[{"ts":1705326300000,"text":"User prefers HDHP","tags":["preference"]}],"count":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_ai_memory","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/ai/memory\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/memory', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/ai/memory',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Add AI memory item","description":"Add a memory item to the AI conversation context.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"count":5}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_ai_memory","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sessionId","text"],"properties":{"sessionId":{"type":"string"},"text":{"type":"string","maxLength":8000},"tags":{"type":"array","maxItems":10,"items":{"type":"string"}}}},"examples":{"default":{"summary":"Example request","value":{"sessionId":"sess-123","text":"User prefers HDHP plans","tags":["preference"]}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/memory\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"key\":\"preference\",\"value\":\"medical\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/memory', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"key\":\"preference\",\"value\":\"medical\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/memory',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"key\":\"preference\",\"value\":\"medical\"}\n)\ndata = response.json()"}]}},"/api/ai/plan-recommendations/feedback":{"post":{"summary":"Submit recommendation feedback","description":"Record user feedback on AI plan recommendations.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"success":true,"message":"Feedback recorded"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_ai_planrecommendations_feedback","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["recommendationId"],"properties":{"recommendationId":{"type":"string"},"userChoice":{"type":"string"},"feedback":{"type":"string"},"rating":{"type":"integer","minimum":1,"maximum":5}}},"examples":{"default":{"summary":"Example request","value":{"recommendationId":"rec-123","rating":5,"feedback":"Very helpful"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/ai/plan-recommendations/feedback\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"recommendationId\":\"rec-123\",\"helpful\":true}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/ai/plan-recommendations/feedback', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"recommendationId\":\"rec-123\",\"helpful\":true})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/ai/plan-recommendations/feedback',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"recommendationId\":\"rec-123\",\"helpful\":true}\n)\ndata = response.json()"}]}},"/api/analytics/funnels":{"get":{"summary":"Get conversion funnel analytics","description":"Returns conversion funnel data for user journeys.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"startDate","in":"query","schema":{"type":"string","format":"date"},"description":"Start date for date range filter"},{"name":"endDate","in":"query","schema":{"type":"string","format":"date"},"description":"End date for date range filter"}],"responses":{"200":{"description":"Funnel data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"funnels":{"type":"array","items":{"type":"object","properties":{"step":{"type":"string"},"count":{"type":"integer"},"conversionRate":{"type":"number"}}}}}},"examples":{"success":{"summary":"Funnel analytics","value":{"ok":true,"funnels":[{"name":"case_creation","steps":["start","upload","parse","save"],"conversionRate":0.72},{"name":"report_share","steps":["generate","customize","share"],"conversionRate":0.85}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getAnalyticsFunnels","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/analytics/funnels\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/analytics/funnels', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/analytics/funnels',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/api-keys":{"get":{"summary":"List API keys","description":"Returns all API keys for the user/org without secrets.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"keys":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"List API keys","value":{"ok":true,"keys":[{"id":"key_abc123","name":"Production API","prefix":"bart_sk_abcd123","scopes":["cases:read","cases:write"],"createdAt":"2025-01-10T10:00:00Z","lastUsed":"2025-01-15T14:30:00Z"},{"id":"key_def456","name":"Development","prefix":"bart_sk_test_abcd1","scopes":["cases:read"],"createdAt":"2025-01-05T09:00:00Z","lastUsed":null}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listApiKeys","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/api-keys\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/api-keys',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Create API key","description":"Creates a new API key. Secret returned only once.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"scopes":{"type":"array"},"expiresInDays":{"type":"integer"}}},"examples":{"default":{"summary":"Create API key","value":{"name":"My Integration","scopes":["cases:read","cases:write","exports:read"]}}}}}},"responses":{"200":{"content":{"application/json":{"examples":{"success":{"summary":"API key created","value":{"ok":true,"key":{"id":"key_xyz789","name":"My Integration","prefix":"bart_sk_abcd123","scopes":["cases:read","cases:write","exports:read"]},"secret":"bart_sk_1234567890abcdef...","warning":"Store this secret securely - it will not be shown again"}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"key":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}}}},"secret":{"type":"string","description":"Only shown once at creation"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}},"description":"API key created"},"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"key":{"type":"object"},"warning":{"type":"string"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createApiKey","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/api-keys\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"My API Key\",\"scopes\":[\"cases:read\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"My API Key\",\"scopes\":[\"cases:read\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/api-keys',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"My API Key\",\"scopes\":[\"cases:read\"]}\n)\ndata = response.json()"}]}},"/api/api-keys/{id}":{"delete":{"summary":"Revoke API key","description":"Revokes an API key.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"keyId":{"type":"string"}}},"examples":{"success":{"summary":"Key revoked","value":{"ok":true,"message":"API key revoked successfully"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"revokeApiKey","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/api-keys/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/api-keys/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"Get API key details","description":"Returns API key details with recent usage.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"key":{"type":"object"},"recentUsage":{"type":"array"}}},"examples":{"success":{"summary":"API key details","value":{"ok":true,"key":{"id":"key_abc123","name":"Production API","prefix":"bart_sk_abcd123","scopes":["cases:read","cases:write"],"createdAt":"2025-01-10T10:00:00Z","lastUsed":"2025-01-15T14:30:00Z","usageCount":1542}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getApiKey","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/api-keys/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/api-keys/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update API key metadata","description":"Updates mutable API key fields such as name, description, scopes, limits, and expiration policy.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"operationId":"updateApiKey","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","nullable":true,"maxLength":500},"scopes":{"type":"array","items":{"type":"string"}},"rateLimitPerMinute":{"type":"integer","minimum":1,"maximum":1000},"rateLimitPerDay":{"type":"integer","minimum":1,"maximum":100000},"expiresInDays":{"type":"integer","nullable":true,"minimum":1,"maximum":365}}},"example":{"name":"Production API Key","description":"Key used by integration backend","scopes":["cases:read","cases:write"],"rateLimitPerMinute":120,"rateLimitPerDay":20000,"expiresInDays":90}}}},"responses":{"200":{"description":"API key updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"key":{"type":"object","additionalProperties":true}},"required":["success","message","key"]},"example":{"success":true,"message":"API key updated successfully","key":{"id":"key_abc123","keyPrefix":"bart_sk_abcd123","name":"Production API Key","scopes":["cases:read","cases:write"],"status":"active"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/api-keys/{id}/usage":{"get":{"summary":"Get API key usage stats","description":"Returns usage statistics for an API key.","tags":["API Keys"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"days","in":"query","schema":{"type":"integer","default":7},"description":"Query parameter for filtering or options"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"usage":{"type":"object"}}},"examples":{"success":{"summary":"Usage stats","value":{"ok":true,"usage":{"total":1542,"last24h":45,"last7d":312,"byEndpoint":{"/api/cases":800,"/api/cases/{id}":500,"/api/web-reports/generate":242}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getApiKeyUsage","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/api-keys/EXAMPLE_ID/usage\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys/EXAMPLE_ID/usage', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/api-keys/EXAMPLE_ID/usage',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/api-keys/scopes":{"get":{"summary":"List available scopes","description":"Returns all available API key scopes.","tags":["API Keys"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"Available scopes","value":{"ok":true,"scopes":[{"id":"cases:read","description":"Read cases"},{"id":"cases:write","description":"Create and update cases"},{"id":"exports:read","description":"View reports"},{"id":"exports:write","description":"Generate reports"},{"id":"plans:read","description":"Read plan library"},{"id":"plans:write","description":"Modify plan library"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"listApiScopes","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/api-keys/scopes\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/api-keys/scopes', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/api-keys/scopes',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/assets":{"get":{"summary":"List broker assets","description":"Returns all broker assets (logos, headshots).","tags":["Assets"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"kind","in":"query","schema":{"type":"string","enum":["logo","headshot"]},"description":"Query parameter for filtering or options"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"assets":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"List assets","value":{"ok":true,"assets":[{"id":"asset_logo_123","type":"logo","fileName":"company-logo.png","url":"https://cdn.trybart.com/assets/logo_123.png","size":45678,"uploadedAt":"2025-01-10T10:00:00Z"},{"id":"asset_doc_456","type":"document","fileName":"rate-sheet.pdf","url":"https://cdn.trybart.com/assets/doc_456.pdf","size":1024000,"uploadedAt":"2025-01-12T14:30:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listBrokerAssets","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/assets\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/assets', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/assets',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/assets/{assetId}":{"get":{"summary":"Get or download asset","description":"Returns asset content or redirects to remote URL.","tags":["Assets"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"assetId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Binary content","content":{"image/*":{"schema":{"type":"string","format":"binary"}},"application/json":{"examples":{"success":{"summary":"Asset details","value":{"ok":true,"asset":{"id":"asset_logo_123","type":"logo","fileName":"company-logo.png","url":"https://cdn.trybart.com/assets/logo_123.png","size":45678,"mimeType":"image/png","uploadedAt":"2025-01-10T10:00:00Z"}}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"asset":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"fileName":{"type":"string"},"url":{"type":"string"},"size":{"type":"integer"},"mimeType":{"type":"string"},"uploadedAt":{"type":"string","format":"date-time"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"302":{"description":"Redirect to remote URL"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getAsset","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/assets/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/assets/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/assets/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/assets/register":{"post":{"summary":"Register remote asset","description":"Registers a URL as a remote asset.","tags":["Assets"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string"},"kind":{"type":"string"},"label":{"type":"string"}}},"examples":{"default":{"summary":"Register remote asset","value":{"url":"https://example.com/logo.png","type":"logo","name":"Company Logo"}}}}}},"responses":{"200":{"description":"Registered","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"asset":{"type":"object"}}},"examples":{"success":{"summary":"Asset registered","value":{"ok":true,"assetId":"asset_ext_789","url":"https://example.com/logo.png"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid URL"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"registerRemoteAsset","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/assets/register\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\":\"https://...\",\"type\":\"logo\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/assets/register', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"url\":\"https://...\",\"type\":\"logo\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/assets/register',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"url\":\"https://...\",\"type\":\"logo\"}\n)\ndata = response.json()"}]}},"/api/assets/upload":{"post":{"summary":"Upload asset file","description":"Uploads an image file to S3. Max 5MB.","tags":["Assets"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Asset file to upload"},"type":{"type":"string","description":"Asset type"}},"required":["file"]}}}},"responses":{"200":{"description":"Uploaded","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"asset":{"type":"object"}}},"examples":{"success":{"summary":"Asset uploaded","value":{"ok":true,"assetId":"asset_new_123","url":"https://cdn.trybart.com/assets/new_123.png","size":45678}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing or invalid file"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"uploadAsset","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/assets/upload\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@logo.png\" \\\n  -F \"type=logo\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', fileInput.files[0]);\nformData.append('type', 'logo');\n\nconst response = await fetch('https://app.trybart.com/api/assets/upload', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('logo.png', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/assets/upload',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f},\n        data={'type': 'logo'}\n    )\ndata = response.json()"}]}},"/api/azure/cu/analyzeBinary":{"post":{"summary":"Analyze document with Azure Document Intelligence","description":"Submits a document for analysis using Azure Document Intelligence (form recognizer).","tags":["Parse"],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Binary file for Azure analysis"}},"required":["file"]}}}},"responses":{"200":{"description":"Analysis started","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"operationLocation":{"type":"string","description":"URL to poll for results"}}},"examples":{"success":{"summary":"Analysis started","value":{"ok":true,"operationLocation":"https://eastus.api.cognitive.microsoft.com/documentintelligence/documentModels/prebuilt-layout:analyze?api-version=2024-02-29-preview&resultId=abc123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Azure service unavailable"}},"operationId":"analyzeDocumentBinary","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/azure/cu/analyzeBinary\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/octet-stream\" \\\n  --data-binary @document.pdf"},{"lang":"javascript","label":"JavaScript","source":"const file = await fetch('document.pdf').then(r => r.blob());\nconst response = await fetch('https://app.trybart.com/api/azure/cu/analyzeBinary', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/octet-stream'\n  },\n  body: file\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('document.pdf', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/azure/cu/analyzeBinary',\n        headers={\n            'Authorization': 'Bearer YOUR_TOKEN',\n            'Content-Type': 'application/octet-stream'\n        },\n        data=f.read()\n    )\ndata = response.json()"}]}},"/api/azure/cu/verify":{"post":{"summary":"Verify Azure Document Intelligence configuration","description":"Tests Azure Document Intelligence connectivity and configuration.","tags":["Parse"],"responses":{"200":{"description":"Configuration verified","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"configured":{"type":"boolean"},"endpoint":{"type":"string"}}},"examples":{"configured":{"summary":"Azure configured","value":{"ok":true,"configured":true,"endpoint":"https://bart-doc-intel.cognitiveservices.azure.com/"}},"notConfigured":{"summary":"Azure not configured","value":{"ok":true,"configured":false,"endpoint":null}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"verifyAzureConfig","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/azure/cu/verify\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/azure/cu/verify', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/azure/cu/verify',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{}}}}}},"/api/case-shares/{token}":{"get":{"summary":"Get shared case details for the accept page","description":"Returns the metadata needed to render the accept page for a shared case: sharer name, employer name, plan count, expiration, plus the caller's organization memberships (so the accept page can render the org picker without a second roundtrip). Anonymous (unauthenticated) callers receive recipientOrgs=null. If the share has been consumed by the same user, returns alreadyConsumedSelf with the redeemed caseId so the page can redirect them to their fork.","tags":["Cases"],"security":[],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"},"description":"Share token from the email accept URL"}],"responses":{"200":{"description":"Share details (or alreadyConsumedSelf with caseId)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"alreadyConsumedSelf":{"type":"boolean"},"caseId":{"type":"string"},"share":{"type":"object","properties":{"shareType":{"type":"string","enum":["email_invite","user","link"]},"status":{"type":"string","enum":["pending","consumed","declined","expired","revoked"]},"expiresAt":{"type":"string","format":"date-time","nullable":true},"sharerName":{"type":"string"},"sharerEmail":{"type":"string","nullable":true},"employerName":{"type":"string"},"planCount":{"type":"integer","nullable":true},"policyPeriod":{"type":"string","nullable":true}}},"recipientOrgs":{"type":"array","nullable":true,"items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"type":"string"}}}}}}}}},"404":{"description":"Token not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string"}}}}}},"410":{"description":"Share is in a terminal state (expired, revoked, declined, already_consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string","enum":["expired","revoked","declined","already_consumed"]}}}}}}},"operationId":"getCaseSharesToken"}},"/api/case-shares/{token}/accept":{"post":{"summary":"Accept a shared case (fork into target org)","description":"Accepts a pending share by token. Loads the source case from storage, writes a new copy under the recipient's user, inserts a case row in the recipient's chosen organization, and marks the share row consumed. Recipient must be a member of targetOrgId. Returns the new caseId on success. If the recipient already accepted this share previously, returns alreadyConsumedSelf with the existing redeemed caseId so the client can redirect to their fork.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"},"description":"Share token"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["targetOrgId"],"properties":{"targetOrgId":{"type":"string","description":"Organization ID where the fork will be added. Must be one the caller is a member of."}}},"example":{"targetOrgId":"org_abc123"}}}},"responses":{"200":{"description":"Fork created (or alreadyConsumedSelf redirect)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"alreadyConsumedSelf":{"type":"boolean"},"caseId":{"type":"string"},"employerName":{"type":"string"}}}}}},"400":{"description":"Missing token or targetOrgId"},"401":{"description":"Authentication required"},"403":{"description":"Caller is not a member of targetOrgId"},"404":{"description":"Token not found"},"410":{"description":"Share is in a terminal state","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"error":{"type":"string","enum":["expired","revoked","declined","already_consumed","source_deleted"]}}}}}},"500":{"description":"Server error or storage unavailable"}},"operationId":"postCaseSharesTokenAccept"}},"/api/case-shares/{token}/decline":{"post":{"summary":"Decline a shared case","description":"Recipient-initiated decline of a pending share. Marks the share row 'declined'; no fork is created. The sender is not notified.","tags":["Cases"],"security":[{"bearerAuth":[]}],"parameters":[{"in":"path","name":"token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Declined successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"401":{"description":"Authentication required"},"404":{"description":"Token not found"},"410":{"description":"Share already in a terminal state"}},"operationId":"postCaseSharesTokenDecline"}},"/api/cases/{id}/share-link":{"post":{"summary":"Generate shareable link for case","description":"Creates a shareable link for the case that can be sent to anyone. The link grants view access to the case data.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Share link generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"shareToken":{"type":"string","description":"The share token for constructing URLs"},"shareUrl":{"type":"string","format":"uri","description":"The full shareable URL"},"share":{"type":"object","description":"The share record that was created","properties":{"id":{"type":"string","description":"Share record ID"},"shareToken":{"type":"string","description":"Token for accessing the share"},"shareType":{"type":"string","enum":["link"],"description":"Type of share"},"permission":{"type":"string","enum":["view","edit"],"description":"Permission level"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"When the link expires"},"createdAt":{"type":"string","format":"date-time","description":"When the share was created"}}}},"required":["ok","shareToken","shareUrl"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"shareUrl":"https://app.trybart.com/share/abc123xyz","expiresAt":"2025-01-22T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing case ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have permission to share this case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createCaseShareLink","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration date for the share link"}}},"examples":{"default":{"summary":"Generate share link","value":{"expirationDays":30,"permissions":["view"]}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases/EXAMPLE_ID/share-link\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"expirationDays\":30}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/share-link', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"expirationDays\":30})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/share-link',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"expirationDays\":30}\n)\ndata = response.json()"}]}},"/api/cases/{id}/shares":{"get":{"summary":"List all shares for a case","description":"Returns all shares (user shares, email invitations, and links) for a specific case. Only the case owner or users with share management permissions can view this list.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Shares list retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"caseId":{"type":"string","description":"The case ID"},"shares":{"type":"array","description":"List of share records","items":{"type":"object","properties":{"id":{"type":"string","description":"Share record ID"},"shareType":{"type":"string","enum":["user","email_invite","link"],"description":"Type of share"},"permission":{"type":"string","enum":["view","edit"],"description":"Permission level"},"status":{"type":"string","enum":["active","pending","revoked","expired"],"description":"Status of the share"},"sharedWithUserId":{"type":"string","nullable":true,"description":"User ID if share type is user"},"sharedWithEmail":{"type":"string","format":"email","nullable":true,"description":"Email if share type is email_invite"},"shareToken":{"type":"string","nullable":true,"description":"Token if share type is link"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"Expiration date if set"},"createdAt":{"type":"string","format":"date-time","description":"When the share was created"},"createdByUserId":{"type":"string","description":"User ID who created the share"}}}}},"required":["ok","caseId","shares"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"shares":[{"id":"share_1","email":"partner@example.com","permissions":["view"],"createdAt":"2025-01-15T00:00:00Z"},{"id":"share_2","type":"link","permissions":["view"],"expiresAt":"2025-01-22T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing case ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have permission to view shares for this case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listCaseShares","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/EXAMPLE_ID/shares\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/shares', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/shares',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Create a case share","description":"Creates a new share for a case. Supports sharing with a specific user, sending an email invitation, or creating a shareable link.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Share created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"share":{"type":"object","description":"The created share record","properties":{"id":{"type":"string","description":"Share record ID"},"shareType":{"type":"string","enum":["user","email_invite","link"],"description":"Type of share"},"permission":{"type":"string","enum":["view","edit"],"description":"Permission level"},"shareToken":{"type":"string","description":"Share token (for link type shares)"},"invitation":{"type":"object","description":"Invitation details (for email_invite type)","properties":{"token":{"type":"string","description":"Invitation token"},"expiresAt":{"type":"string","format":"date-time","description":"When the invitation expires"}}},"createdAt":{"type":"string","format":"date-time","description":"When the share was created"}}}},"required":["ok","share"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"shareId":"share_new123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid share type or missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have permission to share this case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createCaseShare","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"shareType":{"type":"string","enum":["user","email_invite","link"],"description":"Type of share to create"},"email":{"type":"string","format":"email","description":"Email address to invite (required for email_invite type)"},"userId":{"type":"string","description":"User ID to share with (required for user type)"},"expiresAt":{"type":"string","format":"date-time","description":"Optional expiration date for the share"}},"required":["shareType"]},"examples":{"default":{"summary":"Share case with user","value":{"email":"colleague@example.com","permissions":["view","edit"],"message":"Please review this case"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases/EXAMPLE_ID/shares\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"email\":\"user@example.com\",\"permissions\":[\"view\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/shares', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"email\":\"user@example.com\",\"permissions\":[\"view\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/shares',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"email\":\"user@example.com\",\"permissions\":[\"view\"]}\n)\ndata = response.json()"}]}},"/api/cases/{id}/shares/{shareId}":{"delete":{"summary":"Revoke a case share","description":"Revokes a share, removing access for the shared user or invalidating the share link.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Share revoked successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"revoked":{"type":"boolean","description":"Whether the share was successfully revoked"}},"required":["ok","revoked"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Share removed"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing case ID or share ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"User does not have permission to revoke this share","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case or share not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"revokeCaseShare","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/cases/EXAMPLE_ID/shares/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/EXAMPLE_ID/shares/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/cases/EXAMPLE_ID/shares/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"patch":{"summary":"Update a case share","description":"Updates share permission, expiration, or status for an existing case share.","tags":["Cases"],"security":[{"bearerAuth":[]}],"operationId":"updateCaseShare","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"shareId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"permission":{"type":"string","enum":["view","edit"]},"expiresAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["active","revoked","expired"]}}},"example":{"permission":"view","expiresAt":"2026-12-31T23:59:59Z","status":"active"}}}},"responses":{"200":{"description":"Share updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"share":{"type":"object","additionalProperties":true}},"required":["ok"]},"example":{"ok":true,"share":{"id":"share_123","permission":"view","status":"active"}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/cases/create-with-report":{"post":{"summary":"Create case and generate report in one call","description":"Creates a new case with plan data and automatically generates a shareable web report. This endpoint combines case creation and report generation into a single API call, eliminating the need for client-side rendering.\n\n**Use Cases:**\n- Automated case creation from external systems\n- API integrations (CRM, agency management systems)\n- Batch processing of benefit data\n- Programmatic report generation without browser\n\n**Architecture:**\n- Case metadata saved to PostgreSQL\n- Full case JSON saved to S3\n- Report HTML generated server-side using ServerSideReportRenderer\n- Report hosted on S3 with shareable URL","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaseWithReportRequest"},"examples":{"completeReference":{"summary":"COMPLETE REFERENCE - All benefit types, 4 tiers, all benefit IDs","description":"This example shows ALL supported fields for integration reference. Use this as a template.","value":{"id":"case-acme-2025-complete","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","employer":{"name":"Acme Corporation","address":"123 Main St, Austin, TX 78701","industry":"Technology","sicCode":"7372"},"enrollmentTiers":[{"id":"employee","label":"Employee Only"},{"id":"employeeSpouse","label":"Employee + Spouse"},{"id":"employeeChildren","label":"Employee + Child(ren)"},{"id":"family","label":"Family"}],"planData":{"medical":[{"id":"med-current-ppo","type":"current","benefitType":"medical","planName":"PPO Gold 1500","carrier":"Aetna","rateStructure":"composite","fundingType":"fully-insured","networkType":"PPO","isHSAEligible":false,"policyNumber":"POL-MED-12345","groupNumber":"GRP-67890","benefitPlanId":"AETNA-PPO-GOLD-1500","enrollmentAndRates":{"employee":{"enrolled":85,"rate":650},"employeeSpouse":{"enrolled":32,"rate":1295},"employeeChildren":{"enrolled":18,"rate":1105},"family":{"enrolled":45,"rate":1850}},"benefits":{"deductible":{"value":"$1,500 / $3,000"},"ded-oon":{"value":"$3,000 / $6,000"},"oop":{"value":"$6,000 / $12,000"},"oop-oon":{"value":"$12,000 / $24,000"},"coinsurance":{"value":"20%"},"coins-oon":{"value":"40%"},"pcp":{"value":"$25"},"specialist":{"value":"$50"},"urgent":{"value":"$75"},"er":{"value":"$250"},"hospital":{"value":"20% after deductible"},"outpatient-surgery":{"value":"$250"},"lab":{"value":"$0"},"imaging":{"value":"$100"},"preventive":{"value":"$0 (100% covered)"},"mental":{"value":"$25"},"telehealth":{"value":"$0"},"rx-ded":{"value":"$0"},"rx-card":{"value":"$10 / $35 / $70 / 25%"},"rx-generic":{"value":"$10"},"rx-brand":{"value":"$35"},"rx-specialty":{"value":"25% up to $250"}}},{"id":"med-proposed-hdhp","type":"proposed","benefitType":"medical","planName":"HDHP Bronze 3000","carrier":"Aetna","rateStructure":"composite","fundingType":"fully-insured","networkType":"PPO","isHSAEligible":true,"mapsToPlanId":"med-current-ppo","enrollmentAndRates":{"employee":{"enrolled":85,"rate":485},"employeeSpouse":{"enrolled":32,"rate":970},"employeeChildren":{"enrolled":18,"rate":825},"family":{"enrolled":45,"rate":1380}},"benefits":{"deductible":{"value":"$3,000 / $6,000"},"ded-oon":{"value":"$6,000 / $12,000"},"oop":{"value":"$6,500 / $13,000"},"oop-oon":{"value":"$13,000 / $26,000"},"coinsurance":{"value":"20%"},"coins-oon":{"value":"40%"},"pcp":{"value":"20% after deductible"},"specialist":{"value":"20% after deductible"},"urgent":{"value":"20% after deductible"},"er":{"value":"20% after deductible"},"hospital":{"value":"20% after deductible"},"outpatient-surgery":{"value":"20% after deductible"},"lab":{"value":"20% after deductible"},"imaging":{"value":"20% after deductible"},"preventive":{"value":"$0 (100% covered)"},"mental":{"value":"20% after deductible"},"telehealth":{"value":"$0"},"rx-ded":{"value":"Included in medical"},"rx-card":{"value":"$15 / $40 / $80 / 25%"},"rx-generic":{"value":"$15 after deductible"},"rx-brand":{"value":"$40 after deductible"},"rx-specialty":{"value":"25% after deductible"}}}],"dental":[{"id":"dental-current","type":"current","benefitType":"dental","planName":"Dental PPO Plus","carrier":"Delta Dental","rateStructure":"composite","policyNumber":"POL-DEN-54321","groupNumber":"GRP-11111","enrollmentAndRates":{"employee":{"enrolled":78,"rate":38.5},"employeeSpouse":{"enrolled":28,"rate":72},"employeeChildren":{"enrolled":15,"rate":68},"family":{"enrolled":40,"rate":105}},"benefits":{"dental-annual-max":{"value":"$2,000"},"dental-deductible":{"value":"$50 / $150"},"dental-deductible-oon":{"value":"$75 / $225"},"dental-preventive":{"value":"100%"},"dental-basic":{"value":"80%"},"dental-major":{"value":"50%"},"dental-implants":{"value":"50%"},"dental-ortho":{"value":"50%"},"dental-ortho-max":{"value":"$1,500 lifetime"},"dental-ortho-age":{"value":"Child to age 19"},"dental-waiting-basic":{"value":"None"},"dental-waiting-major":{"value":"12 months"}}}],"vision":[{"id":"vision-current","type":"current","benefitType":"vision","planName":"Vision Plus","carrier":"VSP","rateStructure":"composite","policyNumber":"POL-VIS-99999","enrollmentAndRates":{"employee":{"enrolled":70,"rate":8.5},"employeeSpouse":{"enrolled":25,"rate":16},"employeeChildren":{"enrolled":12,"rate":14.5},"family":{"enrolled":35,"rate":24}},"benefits":{"vision-exam":{"value":"$10 copay"},"vision-exam-frequency":{"value":"12 months"},"vision-frames":{"value":"$175 allowance"},"vision-frames-frequency":{"value":"24 months"},"vision-lenses":{"value":"$25 copay"},"vision-contacts":{"value":"$175 allowance"},"vision-contacts-frequency":{"value":"12 months"},"vision-lasik":{"value":"15% discount"}}}],"life":[{"id":"life-current","type":"current","benefitType":"life","planName":"Basic Life & AD&D","carrier":"Lincoln Financial","rateStructure":"volume","policyNumber":"POL-LIFE-77777","volumeConfig":{"numberOfCovered":180,"volumeAmount":9000000,"maxBenefit":100000,"ratePerUnit":0.145,"rateLabel":"per $1,000","rateDivisor":1000,"adnd":true},"benefits":{"life-benefit-amount":{"value":"1x annual salary"},"life-benefit-multiple":{"value":"1x"},"life-gi-amount":{"value":"$150,000"},"life-max-benefit":{"value":"$500,000"},"life-rate-per-thousand":{"value":"$0.145"},"life-ad-d":{"value":"Equal to life benefit"},"life-dependent-spouse":{"value":"$10,000"},"life-dependent-child":{"value":"$5,000"},"life-age-reduction":{"value":"35% at 65, 50% at 70"},"life-portability":{"value":"Available"}}}],"std":[{"id":"std-current","type":"current","benefitType":"std","planName":"Short-Term Disability","carrier":"Lincoln Financial","rateStructure":"volume","policyNumber":"POL-STD-88888","volumeConfig":{"numberOfCovered":180,"ratePerUnit":0.35,"rateLabel":"per $10","rateDivisor":10,"benefitPercent":"60%","maxWeeklyBenefit":1500,"eliminationPeriod":"0/7 days","benefitDuration":"13 weeks"},"benefits":{"std-benefit-pct":{"value":"60%"},"std-weekly-max":{"value":"$1,500"},"std-elim-accident":{"value":"0 days"},"std-elim-sickness":{"value":"7 days"},"std-max-duration":{"value":"13 weeks"},"std-pre-existing":{"value":"3/12 months"},"std-definition":{"value":"Own occupation"}}}],"ltd":[{"id":"ltd-current","type":"current","benefitType":"ltd","planName":"Long-Term Disability","carrier":"Lincoln Financial","rateStructure":"volume","policyNumber":"POL-LTD-66666","volumeConfig":{"numberOfCovered":180,"ratePerUnit":0.42,"rateLabel":"per $100","rateDivisor":100,"benefitPercent":"60%","maxMonthlyBenefit":10000,"eliminationPeriod":"90 days","benefitDuration":"To SSNRA"},"benefits":{"ltd-benefit-pct":{"value":"60%"},"ltd-monthly-max":{"value":"$10,000"},"ltd-elim-period":{"value":"90 days"},"ltd-max-duration":{"value":"To Social Security Normal Retirement Age"},"ltd-definition":{"value":"Own occ 24 months, then any occ"},"ltd-cola":{"value":"3% simple"},"ltd-own-occ-period":{"value":"24 months"},"ltd-offsets":{"value":"Social Security, Workers Comp"}}}]},"contributionSettings":{"isEnabled":true,"frequency":24,"modelType":"tiered","models":{"global":{"employee":{"type":"%","value":100},"employeeSpouse":{"type":"%","value":75},"employeeChildren":{"type":"%","value":75},"family":{"type":"%","value":75}}}},"reportOptions":{"generateReport":true,"expirationDays":90,"isLive":true,"branding":{"companyName":"Benefits Consulting Group","primaryColor":"#1e40af"}}}},"minimalMedical":{"summary":"Minimal medical-only case (required fields only)","value":{"employerName":"Small Business Inc","planData":{"medical":[{"id":"med-1","type":"current","benefitType":"medical","planName":"Basic PPO","carrier":"BCBS","enrollmentAndRates":{"employee":{"enrolled":10,"rate":500},"family":{"enrolled":5,"rate":1400}},"benefits":{"deductible":{"value":"$2,500 / $5,000"},"oop":{"value":"$7,000 / $14,000"}}}]}}},"request":{"summary":"Create case and generate report","value":{"employerName":"Acme Corp","benefitType":"medical","documents":[{"filename":"renewal.pdf","s3Key":"uploads/doc_001.pdf"}],"reportOptions":{"format":"pdf","includePlanComparison":true}}}}}}},"responses":{"200":{"description":"Case created and report generated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaseWithReportResponse"},"examples":{"success":{"value":{"ok":true,"case":{"id":"case-1710000000-a1b2c3d4","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","blobPath":"users/user123/cases/case-1710000000-a1b2c3d4.json","planHash":"f8e7d6c5b4a3","createdAt":"2025-01-15T10:30:00.000Z","reportTypes":["medical"],"planCount":1},"report":{"generated":true,"reportId":"rpt_abc123def456","shareUrl":"https://reports.trybart.com/r/rpt_abc123def456","qrDataUrl":"data:image/png;base64,iVBORw0KGgo...","expiresAt":"2025-02-14T10:30:00.000Z","isLive":false},"durationMs":1250}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Trial limit exceeded"},"413":{"description":"Case data too large (max 50MiB of UTF-8 JSON)"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createCaseWithReport","x-codeSamples":[{"lang":"curl","label":"cURL (Complete 4-Tier Medical)","source":"curl -X POST \"https://app.trybart.com/api/cases/create-with-report\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"employerName\": \"Acme Corporation\",\n  \"policyPeriod\": \"01/01/2025 - 12/31/2025\",\n  \"enrollmentTiers\": [\n    {\"id\": \"employee\", \"label\": \"Employee Only\"},\n    {\"id\": \"employeeSpouse\", \"label\": \"Employee + Spouse\"},\n    {\"id\": \"employeeChildren\", \"label\": \"Employee + Child(ren)\"},\n    {\"id\": \"family\", \"label\": \"Family\"}\n  ],\n  \"planData\": {\n    \"medical\": [{\n      \"id\": \"med-current\",\n      \"type\": \"current\",\n      \"benefitType\": \"medical\",\n      \"planName\": \"PPO Gold 1500\",\n      \"carrier\": \"Aetna\",\n      \"rateStructure\": \"composite\",\n      \"policyNumber\": \"POL-12345\",\n      \"groupNumber\": \"GRP-67890\",\n      \"enrollmentAndRates\": {\n        \"employee\": {\"enrolled\": 85, \"rate\": 650.00},\n        \"employeeSpouse\": {\"enrolled\": 32, \"rate\": 1295.00},\n        \"employeeChildren\": {\"enrolled\": 18, \"rate\": 1105.00},\n        \"family\": {\"enrolled\": 45, \"rate\": 1850.00}\n      },\n      \"benefits\": {\n        \"deductible\": {\"value\": \"$1,500 / $3,000\"},\n        \"ded-oon\": {\"value\": \"$3,000 / $6,000\"},\n        \"oop\": {\"value\": \"$6,000 / $12,000\"},\n        \"oop-oon\": {\"value\": \"$12,000 / $24,000\"},\n        \"coinsurance\": {\"value\": \"20%\"},\n        \"coins-oon\": {\"value\": \"40%\"},\n        \"pcp\": {\"value\": \"$25\"},\n        \"specialist\": {\"value\": \"$50\"},\n        \"urgent\": {\"value\": \"$75\"},\n        \"er\": {\"value\": \"$250\"},\n        \"hospital\": {\"value\": \"20% after deductible\"},\n        \"outpatient-surgery\": {\"value\": \"$250\"},\n        \"lab\": {\"value\": \"$0\"},\n        \"imaging\": {\"value\": \"$100\"},\n        \"preventive\": {\"value\": \"$0 (100% covered)\"},\n        \"mental\": {\"value\": \"$25\"},\n        \"telehealth\": {\"value\": \"$0\"},\n        \"rx-ded\": {\"value\": \"$0\"},\n        \"rx-generic\": {\"value\": \"$10\"},\n        \"rx-brand\": {\"value\": \"$35\"},\n        \"rx-specialty\": {\"value\": \"25% up to $250\"}\n      }\n    }]\n  },\n  \"contributionSettings\": {\n    \"isEnabled\": true,\n    \"frequency\": 24,\n    \"modelType\": \"tiered\",\n    \"models\": {\n      \"global\": {\n        \"employee\": {\"type\": \"%\", \"value\": 100},\n        \"employeeSpouse\": {\"type\": \"%\", \"value\": 75},\n        \"employeeChildren\": {\"type\": \"%\", \"value\": 75},\n        \"family\": {\"type\": \"%\", \"value\": 75}\n      }\n    }\n  },\n  \"reportOptions\": {\"generateReport\": true, \"expirationDays\": 30}\n}'"},{"lang":"javascript","label":"JavaScript (Multi-Benefit)","source":"const casePayload = {\n  employerName: 'Acme Corporation',\n  policyPeriod: '01/01/2025 - 12/31/2025',\n  enrollmentTiers: [\n    { id: 'employee', label: 'Employee Only' },\n    { id: 'employeeSpouse', label: 'Employee + Spouse' },\n    { id: 'employeeChildren', label: 'Employee + Child(ren)' },\n    { id: 'family', label: 'Family' }\n  ],\n  planData: {\n    medical: [{\n      id: 'med-current', type: 'current', benefitType: 'medical',\n      planName: 'PPO Gold', carrier: 'Aetna', rateStructure: 'composite',\n      enrollmentAndRates: {\n        employee: { enrolled: 85, rate: 650 },\n        employeeSpouse: { enrolled: 32, rate: 1295 },\n        employeeChildren: { enrolled: 18, rate: 1105 },\n        family: { enrolled: 45, rate: 1850 }\n      },\n      benefits: {\n        deductible: { value: '$1,500 / $3,000' },\n        oop: { value: '$6,000 / $12,000' },\n        coinsurance: { value: '20%' },\n        pcp: { value: '$25' }, specialist: { value: '$50' },\n        urgent: { value: '$75' }, er: { value: '$250' },\n        'rx-generic': { value: '$10' }, 'rx-brand': { value: '$35' }\n      }\n    }],\n    dental: [{\n      id: 'dental-current', type: 'current', benefitType: 'dental',\n      planName: 'Dental PPO', carrier: 'Delta Dental',\n      enrollmentAndRates: {\n        employee: { enrolled: 78, rate: 38.50 },\n        employeeSpouse: { enrolled: 28, rate: 72 },\n        employeeChildren: { enrolled: 15, rate: 68 },\n        family: { enrolled: 40, rate: 105 }\n      },\n      benefits: {\n        'dental-annual-max': { value: '$2,000' },\n        'dental-deductible': { value: '$50 / $150' },\n        'dental-preventive': { value: '100%' },\n        'dental-basic': { value: '80%' },\n        'dental-major': { value: '50%' }\n      }\n    }],\n    life: [{\n      id: 'life-current', type: 'current', benefitType: 'life',\n      planName: 'Basic Life & AD&D', carrier: 'Lincoln',\n      rateStructure: 'volume',\n      volumeConfig: {\n        numberOfCovered: 180, volumeAmount: 9000000,\n        ratePerUnit: 0.145, rateDivisor: 1000, adnd: true\n      },\n      benefits: {\n        'life-benefit-multiple': { value: '1x salary' },\n        'life-gi-amount': { value: '$150,000' },\n        'life-max-benefit': { value: '$500,000' },\n        'life-ad-d': { value: 'Equal to life benefit' }\n      }\n    }]\n  },\n  contributionSettings: {\n    isEnabled: true, frequency: 24, modelType: 'tiered',\n    models: { global: {\n      employee: { type: '%', value: 100 },\n      employeeSpouse: { type: '%', value: 75 },\n      employeeChildren: { type: '%', value: 75 },\n      family: { type: '%', value: 75 }\n    }}\n  },\n  reportOptions: { generateReport: true, expirationDays: 60, isLive: true }\n};\n\nconst response = await fetch('https://app.trybart.com/api/cases/create-with-report', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN', 'Content-Type': 'application/json' },\n  body: JSON.stringify(casePayload)\n});\nconst result = await response.json();\nconsole.log('Case ID:', result.case.id);\nconsole.log('Share URL:', result.report.shareUrl);"},{"lang":"python","label":"Python (Complete Example)","source":"import requests\n\ncase_payload = {\n    'employerName': 'Acme Corporation',\n    'policyPeriod': '01/01/2025 - 12/31/2025',\n    'enrollmentTiers': [\n        {'id': 'employee', 'label': 'Employee Only'},\n        {'id': 'employeeSpouse', 'label': 'Employee + Spouse'},\n        {'id': 'employeeChildren', 'label': 'Employee + Child(ren)'},\n        {'id': 'family', 'label': 'Family'}\n    ],\n    'planData': {\n        'medical': [{\n            'id': 'med-current',\n            'type': 'current',\n            'benefitType': 'medical',\n            'planName': 'PPO Gold 1500',\n            'carrier': 'Aetna',\n            'rateStructure': 'composite',\n            'policyNumber': 'POL-12345',\n            'groupNumber': 'GRP-67890',\n            'enrollmentAndRates': {\n                'employee': {'enrolled': 85, 'rate': 650.00},\n                'employeeSpouse': {'enrolled': 32, 'rate': 1295.00},\n                'employeeChildren': {'enrolled': 18, 'rate': 1105.00},\n                'family': {'enrolled': 45, 'rate': 1850.00}\n            },\n            'benefits': {\n                'deductible': {'value': '$1,500 / $3,000'},\n                'ded-oon': {'value': '$3,000 / $6,000'},\n                'oop': {'value': '$6,000 / $12,000'},\n                'oop-oon': {'value': '$12,000 / $24,000'},\n                'coinsurance': {'value': '20%'},\n                'coins-oon': {'value': '40%'},\n                'pcp': {'value': '$25'},\n                'specialist': {'value': '$50'},\n                'urgent': {'value': '$75'},\n                'er': {'value': '$250'},\n                'hospital': {'value': '20% after deductible'},\n                'outpatient-surgery': {'value': '$250'},\n                'lab': {'value': '$0'},\n                'imaging': {'value': '$100'},\n                'preventive': {'value': '$0 (100% covered)'},\n                'mental': {'value': '$25'},\n                'telehealth': {'value': '$0'},\n                'rx-ded': {'value': '$0'},\n                'rx-generic': {'value': '$10'},\n                'rx-brand': {'value': '$35'},\n                'rx-specialty': {'value': '25% up to $250'}\n            }\n        }],\n        'dental': [{\n            'id': 'dental-current',\n            'type': 'current',\n            'benefitType': 'dental',\n            'planName': 'Dental PPO Plus',\n            'carrier': 'Delta Dental',\n            'enrollmentAndRates': {\n                'employee': {'enrolled': 78, 'rate': 38.50},\n                'employeeSpouse': {'enrolled': 28, 'rate': 72.00},\n                'employeeChildren': {'enrolled': 15, 'rate': 68.00},\n                'family': {'enrolled': 40, 'rate': 105.00}\n            },\n            'benefits': {\n                'dental-annual-max': {'value': '$2,000'},\n                'dental-deductible': {'value': '$50 / $150'},\n                'dental-preventive': {'value': '100%'},\n                'dental-basic': {'value': '80%'},\n                'dental-major': {'value': '50%'},\n                'dental-ortho': {'value': '50%'},\n                'dental-ortho-max': {'value': '$1,500 lifetime'}\n            }\n        }]\n    },\n    'contributionSettings': {\n        'isEnabled': True,\n        'frequency': 24,\n        'modelType': 'tiered',\n        'models': {\n            'global': {\n                'employee': {'type': '%', 'value': 100},\n                'employeeSpouse': {'type': '%', 'value': 75},\n                'employeeChildren': {'type': '%', 'value': 75},\n                'family': {'type': '%', 'value': 75}\n            }\n        }\n    },\n    'reportOptions': {\n        'generateReport': True,\n        'expirationDays': 60,\n        'isLive': True\n    }\n}\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/create-with-report',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json=case_payload\n)\nresult = response.json()\nprint(f\"Case ID: {result['case']['id']}\")\nprint(f\"Plans: {result['case']['planCount']}\")\nprint(f\"Share URL: {result['report']['shareUrl']}\")"}]}},"/api/cases/create-from-files":{"post":{"summary":"Parse files and automatically create or review a case","description":"Uploads one to ten benefit documents and retains every original before parsing. mode=automatic commits a setupVersion 1.1 case and may generate a report; mode=review returns a candidateCase with parser provenance, confidence, and per-file errors, and performs no case, webhook, notification, or report side effect. Commit an approved candidate with POST /api/v1/cases.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["files","employerName"],"properties":{"mode":{"type":"string","enum":["automatic","review"],"default":"automatic","description":"Choose automatic commit or review-before-commit."},"files":{"type":"array","items":{"type":"string","format":"binary"},"description":"One or more files to parse (PDF, Excel, CSV, DOCX, PNG, JPEG). Max 10 files, 25MB each.","maxItems":10},"employerName":{"type":"string","description":"Name of the employer/group","example":"Acme Corporation"},"policyPeriod":{"type":"string","description":"Policy period (e.g., '01/01/2025 - 12/31/2025')","example":"01/01/2025 - 12/31/2025"},"caseId":{"type":"string","description":"Optional case ID (auto-generated if not provided)","example":"case-acme-2025"},"benefitTypes":{"type":"string","description":"JSON array of expected benefit types for better parsing","example":"[\"medical\", \"dental\", \"vision\"]"},"defaultBenefitType":{"type":"string","enum":["medical","dental","vision","life"],"default":"medical","description":"Default benefit type if not detected from file"},"carrier":{"type":"string","description":"Carrier hint for better parsing","example":"Blue Cross Blue Shield"},"enrollmentTiers":{"type":"string","description":"JSON array of enrollment tier definitions","example":"[{\"id\": \"employee\", \"label\": \"Employee Only\"}, {\"id\": \"family\", \"label\": \"Family\"}]"},"reportOptions":{"type":"string","description":"JSON object with report generation options","example":"{\"generateReport\": true, \"expirationDays\": 30, \"isLive\": true}"},"parseOptions":{"type":"string","description":"JSON object with parsing options","example":"{\"forceAI\": false}"},"employer":{"type":"string","description":"JSON object with employer metadata","example":"{\"name\": \"Acme Corp\", \"industry\": \"Technology\", \"sicCode\": \"7372\"}"}}},"examples":{"simpleQuote":{"summary":"Simple - Single PDF Quote","description":"Upload a single carrier quote PDF and get a shareable report","value":{"files":["(binary PDF file)"],"employerName":"Acme Corporation","policyPeriod":"2025","carrier":"BCBS"}},"multipleFiles":{"summary":"Multiple Files - Quote + Rate Sheet","description":"Upload multiple files from different carriers","value":{"files":["(carrier_quote.pdf)","(rate_sheet.xlsx)"],"employerName":"TechStart Inc","policyPeriod":"01/01/2025 - 12/31/2025","benefitTypes":"[\"medical\", \"dental\"]","reportOptions":"{\"generateReport\": true, \"expirationDays\": 60, \"isLive\": true}"}},"fullOptions":{"summary":"Full Options - All Parameters","description":"Complete example with all available options","value":{"files":["(quote.pdf)","(sbc.pdf)","(rates.xlsx)"],"employerName":"Enterprise Corp","policyPeriod":"07/01/2025 - 06/30/2026","caseId":"case-enterprise-2025","benefitTypes":"[\"medical\", \"dental\", \"vision\"]","defaultBenefitType":"medical","carrier":"Aetna","enrollmentTiers":"[{\"id\": \"employee\", \"label\": \"Employee Only\"}, {\"id\": \"employeeSpouse\", \"label\": \"Employee + Spouse\"}, {\"id\": \"employeeChildren\", \"label\": \"Employee + Child(ren)\"}, {\"id\": \"family\", \"label\": \"Family\"}]","reportOptions":"{\"generateReport\": true, \"expirationDays\": 90, \"isLive\": true, \"branding\": {\"companyName\": \"ABC Benefits Agency\"}}","parseOptions":"{\"forceAI\": true}","employer":"{\"name\": \"Enterprise Corp\", \"address\": \"123 Main St, Austin TX\", \"industry\": \"Finance\", \"sicCode\": \"6022\"}"}}}}}},"responses":{"200":{"description":"Case created and report generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"requestId":{"type":"string","description":"Unique request ID for tracing","example":"cff-1234567890-abc12"},"case":{"type":"object","properties":{"id":{"type":"string","example":"case-1234567890-abcd1234"},"employerName":{"type":"string","example":"Acme Corporation"},"policyPeriod":{"type":"string","example":"01/01/2025 - 12/31/2025"},"blobPath":{"type":"string","example":"users/user123/cases/case-123.json"},"planHash":{"type":"string","example":"a1b2c3d4e5f6"},"createdAt":{"type":"string","format":"date-time"},"reportTypes":{"type":"array","items":{"type":"string"},"example":["medical","dental"]},"planCount":{"type":"integer","example":4}}},"parsing":{"type":"object","properties":{"filesProcessed":{"type":"integer","example":2},"filesSucceeded":{"type":"integer","example":2},"filesFailed":{"type":"integer","example":0},"plansExtracted":{"type":"integer","example":4},"details":{"type":"array","items":{"type":"object","properties":{"fileName":{"type":"string"},"ok":{"type":"boolean"},"source":{"type":"string","example":"ai_text"},"confidence":{"type":"number","example":0.92},"planCount":{"type":"integer"},"durationMs":{"type":"integer"}}}}}},"report":{"type":"object","properties":{"generated":{"type":"boolean","example":true},"reportId":{"type":"string","example":"rpt_abc123def456"},"shareUrl":{"type":"string","format":"uri","example":"https://app.trybart.com/share/rpt_abc123def456"},"qrDataUrl":{"type":"string","description":"Base64 data URL of QR code image"},"expiresAt":{"type":"string","format":"date-time"},"isLive":{"type":"boolean","example":true}}},"aiCredits":{"type":"object","description":"AI credit usage (for trial users)","properties":{"used":{"type":"integer"},"limit":{"type":"integer"},"remaining":{"type":"integer"}}},"durationMs":{"type":"integer","description":"Total request duration in milliseconds","example":4523}}},"example":{"ok":true,"requestId":"cff-1710234567890-x7k2m","case":{"id":"case-1710234567890-a1b2c3d4","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","blobPath":"users/user-123/cases/case-1710234567890-a1b2c3d4.json","planHash":"f8e7d6c5b4a3","createdAt":"2025-03-12T15:30:00.000Z","reportTypes":["medical","dental"],"planCount":4},"parsing":{"filesProcessed":2,"filesSucceeded":2,"filesFailed":0,"plansExtracted":4,"details":[{"fileName":"bcbs_quote.pdf","ok":true,"source":"ai_text","confidence":0.94,"planCount":3,"durationMs":2340},{"fileName":"delta_dental.pdf","ok":true,"source":"ai_text","confidence":0.91,"planCount":1,"durationMs":1890}]},"report":{"generated":true,"reportId":"rpt_abc123def456ghi789","shareUrl":"https://app.trybart.com/share/rpt_abc123def456ghi789","qrDataUrl":"data:image/png;base64,iVBORw0KGgo...","expiresAt":"2025-04-11T15:30:00.000Z","isLive":true},"durationMs":4523}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad request - validation error or no files","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"noFiles":{"value":{"ok":false,"error":"no_files","message":"At least one file is required","requestId":"cff-123-abc"}},"validationError":{"value":{"ok":false,"error":"validation_error","message":"Invalid request parameters","errors":[{"path":"employerName","message":"Required"}],"requestId":"cff-123-abc"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"413":{"description":"Payload too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable - parsing failed or no plans extracted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"examples":{"allParsesFailed":{"value":{"ok":false,"error":"all_parses_failed","message":"Failed to parse any uploaded files","parseErrors":[{"fileName":"corrupted.pdf","error":"parse_exception","message":"Invalid PDF structure"}],"requestId":"cff-123-abc"}},"noPlansExtracted":{"value":{"ok":false,"error":"no_plans_extracted","message":"Could not extract any plan data from the uploaded files","requestId":"cff-123-abc"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"$ref":"#/components/responses/InternalServerError"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST 'https://app.trybart.com/api/cases/create-from-files' \\\n  -H 'Authorization: Bearer YOUR_API_KEY' \\\n  -F 'files=@bcbs_quote.pdf' \\\n  -F 'files=@delta_dental.pdf' \\\n  -F 'employerName=Acme Corporation' \\\n  -F 'policyPeriod=01/01/2025 - 12/31/2025' \\\n  -F 'reportOptions={\"generateReport\": true, \"expirationDays\": 30}'"},{"lang":"python","label":"Python","source":"import requests\n\nfiles = [\n    ('files', ('bcbs_quote.pdf', open('bcbs_quote.pdf', 'rb'), 'application/pdf')),\n    ('files', ('delta_dental.pdf', open('delta_dental.pdf', 'rb'), 'application/pdf')),\n]\n\ndata = {\n    'employerName': 'Acme Corporation',\n    'policyPeriod': '01/01/2025 - 12/31/2025',\n    'reportOptions': '{\"generateReport\": true, \"expirationDays\": 30, \"isLive\": true}'\n}\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cases/create-from-files',\n    headers={'Authorization': 'Bearer YOUR_API_KEY'},\n    files=files,\n    data=data\n)\n\nresult = response.json()\nprint(f\"Case ID: {result['case']['id']}\")\nprint(f\"Plans extracted: {result['parsing']['plansExtracted']}\")\nprint(f\"Share URL: {result['report']['shareUrl']}\")"},{"lang":"javascript","label":"Node.js","source":"const FormData = require('form-data');\nconst fs = require('fs');\nconst axios = require('axios');\n\nconst form = new FormData();\nform.append('files', fs.createReadStream('bcbs_quote.pdf'));\nform.append('files', fs.createReadStream('delta_dental.pdf'));\nform.append('employerName', 'Acme Corporation');\nform.append('policyPeriod', '01/01/2025 - 12/31/2025');\nform.append('reportOptions', JSON.stringify({\n  generateReport: true,\n  expirationDays: 30,\n  isLive: true\n}));\n\nconst response = await axios.post(\n  'https://app.trybart.com/api/cases/create-from-files',\n  form,\n  {\n    headers: {\n      'Authorization': 'Bearer YOUR_API_KEY',\n      ...form.getHeaders()\n    }\n  }\n);\n\nconsole.log('Case ID:', response.data.case.id);\nconsole.log('Share URL:', response.data.report.shareUrl);"}],"operationId":"postApiCasesCreateFromFiles"}},"/api/cases/import-file":{"post":{"summary":"Import case from file","description":"Imports a case from an uploaded file (JSON, Excel, etc.).","tags":["Cases"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Case JSON file to import"}},"required":["file"]}}}},"responses":{"200":{"description":"Case imported","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"caseId":{"type":"string"},"imported":{"type":"boolean"}}},"examples":{"success":{"summary":"Case imported successfully","value":{"ok":true,"caseId":"case-imported-2025-abc123","imported":true,"planCount":8,"benefitTypes":["medical","dental","vision"]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file format"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"importCaseFromFile","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cases/import-file\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@case_data.json\" \\\n  -F \"overwriteExisting=false\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', fileInput.files[0]);\nformData.append('overwriteExisting', 'false');\n\nconst response = await fetch('https://app.trybart.com/api/cases/import-file', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('case_data.json', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/cases/import-file',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f},\n        data={'overwriteExisting': 'false'}\n    )\ndata = response.json()"}]}},"/api/cases/shared-with-me":{"get":{"summary":"List cases shared with current user","description":"Returns all cases that have been shared with the authenticated user, either directly or via email invitation.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"List of shared cases retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"cases":{"type":"array","description":"List of cases shared with the user","items":{"type":"object","properties":{"id":{"type":"string","description":"Case ID"},"employerName":{"type":"string","description":"Employer name"},"policyPeriod":{"type":"string","description":"Policy period"},"sharedByUserId":{"type":"string","description":"User ID who shared the case"},"sharedByEmail":{"type":"string","format":"email","description":"Email of user who shared the case"},"permission":{"type":"string","enum":["view","edit"],"description":"Permission level"},"sharedAt":{"type":"string","format":"date-time","description":"When the case was shared"}}}}},"required":["ok","cases"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"cases":[{"id":"case-shared-1","employerName":"Partner Corp","sharedBy":"partner@example.com","sharedAt":"2025-01-10T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listCasesSharedWithMe","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/shared-with-me\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/shared-with-me', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/shared-with-me',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cases/shared/{token}":{"get":{"summary":"Access case via share link","description":"Retrieves case information using a share link token. Requires authentication.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Case retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"caseId":{"type":"string","description":"The case ID"},"share":{"type":"object","description":"Share details","properties":{"id":{"type":"string","description":"Share record ID"},"permission":{"type":"string","enum":["view","edit"],"description":"Permission level"},"expiresAt":{"type":"string","format":"date-time","nullable":true,"description":"When the share expires"}}}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"case":{"id":"case-acme-2025","employerName":"Acme Corporation","planSummary":{"medical":3,"dental":1,"vision":1}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Share not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getCaseByShareToken","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"},"description":"Authentication or share token"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cases/shared/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cases/shared/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cases/shared/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/cases/{caseId}/files":{"get":{"summary":"List case files in cloud storage","description":"Returns files that were synced for a case.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageCaseFilesResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"files":[{"id":"file_1","name":"SBC.pdf","size":125000,"createdAt":"2025-01-15T00:00:00Z"},{"id":"file_2","name":"Rates.xlsx","size":45000,"createdAt":"2025-01-14T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_cloudstorage_{provider}_cases_{caseId}_files","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"caseId","in":"path","required":true,"schema":{"type":"string"},"description":"Case unique identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/files\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/files', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/files',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/cases/{caseId}/upload":{"post":{"summary":"Upload case file to cloud storage","description":"Uploads a file and associates it with a case.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageUploadResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"fileId":"file_new123","url":"https://drive.google.com/file/xxx"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"No file provided"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Upload failed"}},"operationId":"post_api_cloudstorage_{provider}_cases_{caseId}_upload","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"caseId","in":"path","required":true,"schema":{"type":"string"},"description":"Case unique identifier"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"localFileId":{"type":"string"},"localFileType":{"type":"string"},"description":{"type":"string"},"orgId":{"type":"string"}},"required":["file"]}},"application/json":{"schema":{"type":"object","properties":{"file":{"type":"object","properties":{"name":{"type":"string","description":"Display name"},"content":{"type":"string","description":"Base64 content"},"mimeType":{"type":"string","description":"MIME type"}},"required":["name","content"],"description":"File data or reference"},"localFileId":{"type":"string"},"localFileType":{"type":"string"},"description":{"type":"string","description":"Detailed description"},"orgId":{"type":"string","description":"Associated organization ID"}},"required":["file"]},"examples":{"default":{"summary":"Example request","value":{"filename":"document.pdf","folderId":"folder_123"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/upload\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/upload', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/cases/EXAMPLE_ID/upload',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/disconnect":{"post":{"summary":"Disconnect cloud storage provider","description":"Disconnects the provider for the org.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"provider":{"type":"string","description":"Service provider"},"disconnected":{"type":"boolean"}},"required":["success","provider","disconnected"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Provider disconnected"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_cloudstorage_{provider}_disconnect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","description":"Associated organization ID"}}},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/disconnect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/disconnect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/disconnect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/download/{fileId}":{"get":{"summary":"Download file from cloud storage","description":"Streams file content from the provider.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Binary file content from cloud storage provider. Content-Type varies based on the file type.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"headers":{"Content-Type":{"description":"MIME type of the file","schema":{"type":"string"}},"Content-Disposition":{"description":"Original filename","schema":{"type":"string"}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid provider or file"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Download failed"}},"operationId":"get_api_cloudstorage_{provider}_download_{fileId}","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"fileId","in":"path","required":true,"schema":{"type":"string"},"description":"File identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/google-drive/download/FILE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -o downloaded_file.pdf"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/google-drive/download/FILE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst blob = await response.blob();\nconst url = URL.createObjectURL(blob);"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/google-drive/download/FILE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\nwith open('downloaded_file.pdf', 'wb') as f:\n    f.write(response.content)"}]}},"/api/cloud-storage/{provider}/files":{"get":{"summary":"List files in cloud storage","description":"Lists files in a folder or via search query.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageListResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"files":[{"id":"file_1","name":"Benefits","type":"folder","modifiedAt":"2025-01-15T00:00:00Z"},{"id":"file_2","name":"SBC.pdf","type":"file","size":125000,"modifiedAt":"2025-01-14T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_cloudstorage_{provider}_files","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"folderId","in":"query","required":false,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of items per page"},{"name":"pageToken","in":"query","required":false,"schema":{"type":"string"},"description":"Authentication or share token"},{"name":"query","in":"query","required":false,"schema":{"type":"string"},"description":"Search query string"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/files/{fileId}":{"delete":{"summary":"Delete file from cloud storage","description":"Deletes a file from the provider.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageDeleteResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"File deleted"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"delete_api_cloudstorage_{provider}_files_{fileId}","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"fileId","in":"path","required":true,"schema":{"type":"string"},"description":"File identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"Get cloud storage file metadata","description":"Returns metadata for the specified file.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageFileResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"file":{"id":"file_1","name":"SBC.pdf","size":125000,"mimeType":"application/pdf"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_cloudstorage_{provider}_files_{fileId}","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"fileId","in":"path","required":true,"schema":{"type":"string"},"description":"File identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/files/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/folders":{"post":{"summary":"Create cloud storage folder","description":"Creates a folder in the provider account.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageCreateFolderResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"folderId":"folder_new123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_cloudstorage_{provider}_folders","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Display name"},"parentId":{"type":"string","description":"Parent folder identifier"},"description":{"type":"string","description":"Detailed description"},"orgId":{"type":"string","description":"Associated organization ID"}},"required":["name"]},"examples":{"default":{"summary":"Example request","value":{"name":"New Folder","parentId":"folder_root"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/folders\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"New Folder\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/folders', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"name\":\"New Folder\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/folders',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"name\":\"New Folder\"}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/root-folder":{"put":{"summary":"Set cloud storage root folder","description":"Sets the root folder for the org connection.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageRootFolderResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"rootFolderId":"folder_bart_cases"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"put_api_cloudstorage_{provider}_rootfolder","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"folderId":{"type":"string","description":"Folder identifier"},"folderPath":{"type":"string"},"orgId":{"type":"string","description":"Associated organization ID"}},"required":["folderId"]},"examples":{"default":{"summary":"Example request","value":{"folderId":"folder_bart_cases"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/root-folder\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"folderId\":\"folder-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/root-folder', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"folderId\":\"folder-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/root-folder',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"folderId\":\"folder-123\"}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/status":{"get":{"summary":"Get cloud storage connection status","description":"Returns connection status for a cloud storage provider.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageStatusResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"connected":true,"email":"user@example.com","quotaUsed":1024000000,"quotaTotal":15000000000}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid provider"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_cloudstorage_{provider}_status","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cloud-storage/{provider}/upload":{"post":{"summary":"Upload file to cloud storage","description":"Uploads a file to the provider and returns file metadata.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageUploadResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"fileId":"file_new456","url":"https://drive.google.com/file/xxx"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"No file provided"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Upload failed"}},"operationId":"post_api_cloudstorage_{provider}_upload","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"folderId":{"type":"string"},"caseId":{"type":"string"},"localFileId":{"type":"string"},"localFileType":{"type":"string"},"description":{"type":"string"},"orgId":{"type":"string"}},"required":["file"]}},"application/json":{"schema":{"type":"object","properties":{"file":{"type":"object","properties":{"name":{"type":"string","description":"Display name"},"content":{"type":"string","description":"Base64 content"},"mimeType":{"type":"string","description":"MIME type"}},"required":["name","content"],"description":"File data or reference"},"folderId":{"type":"string","description":"Folder identifier"},"caseId":{"type":"string","description":"Associated case ID"},"localFileId":{"type":"string"},"localFileType":{"type":"string"},"description":{"type":"string","description":"Detailed description"},"orgId":{"type":"string","description":"Associated organization ID"}},"required":["file"]},"examples":{"default":{"summary":"Example request","value":{"filename":"export.pdf","folderId":"folder_123"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/upload\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/upload', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cloud-storage/EXAMPLE_ID/upload',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/cloud-storage/providers":{"get":{"summary":"List cloud storage providers","description":"Returns available cloud storage providers and capabilities.","tags":["Cloud Storage"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloudStorageProvidersResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"providers":[{"id":"google-drive","name":"Google Drive","connected":true},{"id":"dropbox","name":"Dropbox","connected":false},{"id":"onedrive","name":"OneDrive","connected":false}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_cloudstorage_providers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cloud-storage/providers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cloud-storage/providers', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cloud-storage/providers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cognito/config":{"get":{"summary":"Get Cognito configuration","description":"Returns public Cognito configuration for client-side authentication. No authentication required.","tags":["Authentication"],"security":[],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoConfigResponse"},"examples":{"success":{"summary":"Successful response","value":{"userPoolId":"us-east-1_xxx","clientId":"abc123def456","region":"us-east-1","domain":"auth.trybart.com","hostedUiUrl":"https://auth.trybart.com/oauth2/authorize","logoutUrl":"https://auth.trybart.com/logout","supportedProviders":["Google"],"scopes":["email","openid","profile"],"supportsOfflineAccess":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Configuration load failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoErrorResponse"}}}}},"operationId":"get_api_cognito_config","x-public":true,"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cognito/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cognito/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/challenge":{"post":{"summary":"Verify MFA code during login","description":"Verify a TOTP code during the login flow. Uses custom database-backed TOTP implementation.","tags":["Authentication"],"security":[],"responses":{"200":{"description":"MFA verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaChallengeResponse"},"examples":{"success":{"summary":"Successful verification","value":{"success":true,"verified":true,"message":"MFA verification successful"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid code or MFA not enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoErrorResponse"}}}},"429":{"description":"Account locked due to too many failed attempts"}},"operationId":"post_api_cognito_mfa_challenge","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MfaChallengeRequest"},"examples":{"default":{"summary":"Example request","value":{"userId":"abc123-def456-ghi789","code":"123456"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/mfa/challenge\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"challengeResponse\":\"123456\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/challenge', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"challengeResponse\":\"123456\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/mfa/challenge',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"challengeResponse\":\"123456\"}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/check-required":{"post":{"summary":"Check if MFA is required","description":"Checks if MFA is required for the user based on organization settings.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"accessToken":{"type":"string"},"orgId":{"type":"string"}}},"example":{"username":"user@example.com"}}}},"responses":{"200":{"description":"MFA requirement check","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"mfaRequired":{"type":"boolean"},"reason":{"type":"string","nullable":true}}},"examples":{"required":{"summary":"MFA required","value":{"ok":true,"mfaRequired":true,"reason":"organization_policy"}},"notRequired":{"summary":"MFA optional","value":{"ok":true,"mfaRequired":false}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"description":"Invalid access token"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"checkMfaRequired","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/mfa/check-required\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/check-required', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/mfa/check-required',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/disable":{"post":{"summary":"Disable MFA for user","description":"Disables MFA for the authenticated user.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["accessToken"],"properties":{"accessToken":{"type":"string"}}},"examples":{"default":{"summary":"Disable MFA","value":{"code":"123456"}}}}}},"responses":{"200":{"description":"MFA disabled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"message":{"type":"string","example":"MFA disabled"}}},"examples":{"success":{"summary":"MFA disabled","value":{"ok":true,"message":"MFA has been disabled"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"description":"Invalid access token"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"disableMfa","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/mfa/disable\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"123456\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/disable', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"code\":\"123456\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/mfa/disable',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"code\":\"123456\"}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/setup":{"post":{"summary":"Set up MFA for user","description":"Initiates MFA setup for the authenticated user. Returns a secret code and QR code URL.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["accessToken"],"properties":{"accessToken":{"type":"string","description":"AWS Cognito access token"}}},"example":{"username":"user@example.com","mfaType":"SOFTWARE_TOKEN","verificationCode":"123456"}}}},"responses":{"200":{"description":"MFA setup initiated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"secretCode":{"type":"string","description":"TOTP secret code"},"qrCodeUrl":{"type":"string","description":"QR code URL for authenticator app"}}},"examples":{"success":{"summary":"MFA setup initiated","value":{"ok":true,"secretCode":"JBSWY3DPEHPK3PXP","qrCodeUrl":"otpauth://totp/Planlined:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Planlined"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"description":"Invalid or expired access token"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"setupMfa","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/mfa/setup\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/setup', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/mfa/setup',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/status":{"get":{"summary":"Get MFA status","description":"Returns the current MFA configuration status for the user.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"accessToken","in":"query","required":true,"schema":{"type":"string"},"description":"Authentication or share token"}],"responses":{"200":{"description":"MFA status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"mfaEnabled":{"type":"boolean"},"preferredMfaSetting":{"type":"string","nullable":true}}},"examples":{"enabled":{"summary":"MFA enabled","value":{"ok":true,"mfaEnabled":true,"mfaType":"TOTP","lastVerified":"2025-01-15T10:00:00Z"}},"disabled":{"summary":"MFA disabled","value":{"ok":true,"mfaEnabled":false,"mfaType":null}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"description":"Invalid access token"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getMfaStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/cognito/mfa/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/cognito/mfa/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/cognito/mfa/verify":{"post":{"summary":"Verify MFA code","description":"Verifies an MFA code to complete MFA setup or sign-in.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["accessToken","userCode"],"properties":{"accessToken":{"type":"string"},"userCode":{"type":"string","description":"TOTP code from authenticator app"},"session":{"type":"string","description":"Session token for MFA challenge"}}},"examples":{"default":{"summary":"Verify MFA code","value":{"code":"123456"}}}}}},"responses":{"200":{"description":"MFA verified","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"verified":{"type":"boolean","example":true},"message":{"type":"string"}}},"examples":{"success":{"summary":"MFA verified","value":{"ok":true,"verified":true,"message":"MFA successfully enabled"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid code"},"401":{"description":"Invalid access token"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"verifyMfa","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/mfa/verify\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"123456\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/mfa/verify', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"code\":\"123456\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/mfa/verify',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"code\":\"123456\"}\n)\ndata = response.json()"}]}},"/api/cognito/refresh":{"post":{"summary":"Refresh tokens","description":"Refresh ID and access tokens using a valid refresh token.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Tokens refreshed successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoRefreshResponse"},"examples":{"success":{"summary":"Successful response","value":{"id_token":"eyJhbGciOiJSUzI1NiIs...","access_token":"eyJhbGciOiJSUzI1NiIs...","expires_in":3600,"token_type":"Bearer"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"description":"Invalid or expired refresh token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_cognito_refresh","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoRefreshRequest"},"examples":{"default":{"summary":"Example request","value":{"refreshToken":"eyJjdHkiOiJKV1QiLCJl..."}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/refresh\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"refreshToken\":\"token\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/refresh', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"refreshToken\":\"token\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/refresh',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"refreshToken\":\"token\"}\n)\ndata = response.json()"}]}},"/api/cognito/send-verification-code":{"post":{"summary":"Send phone verification code","description":"Set phone number and send SMS verification code for trial activation.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoSendVerificationCodeResponse"},"examples":{"success":{"summary":"Successful response","value":{"success":true,"message":"Verification code sent to your phone"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid phone number format"},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"Phone number already in use"},"429":{"description":"Rate limit exceeded"}},"operationId":"post_api_cognito_sendverificationcode","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoSendVerificationCodeRequest"},"examples":{"default":{"summary":"Example request","value":{"phoneNumber":"+12025551234"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/send-verification-code\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"phone\":\"+15551234567\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/send-verification-code', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"phone\":\"+15551234567\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/send-verification-code',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"phone\":\"+15551234567\"}\n)\ndata = response.json()"}]}},"/api/cognito/token":{"post":{"summary":"Exchange authorization code for tokens","description":"Exchange OAuth authorization code for ID, access, and refresh tokens.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoTokenResponse"},"examples":{"success":{"summary":"Successful response","value":{"id_token":"eyJhbGciOiJSUzI1NiIs...","access_token":"eyJhbGciOiJSUzI1NiIs...","refresh_token":"eyJjdHkiOiJKV1QiLCJl...","expires_in":3600,"token_type":"Bearer"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid authorization code or PKCE verifier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_cognito_token","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoTokenRequest"},"examples":{"default":{"summary":"Example request","value":{"code":"AUTHORIZATION_CODE","redirect_uri":"https://yourapp.com/callback","code_verifier":"optional_pkce_verifier"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/token\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"auth_code\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/token', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"code\":\"auth_code\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/token',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"code\":\"auth_code\"}\n)\ndata = response.json()"}]}},"/api/cognito/verify-phone":{"post":{"summary":"Verify phone number","description":"Verify phone number with SMS code and grant trial access.","tags":["Authentication"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoVerifyPhoneResponse"},"examples":{"success":{"summary":"Successful response","value":{"success":true,"trialGranted":true,"message":"Phone verified and trial access granted","trialUserCreated":true,"requiresTokenRefresh":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid or expired verification code"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Trial abuse detected"},"409":{"description":"Phone number already in use"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_cognito_verifyphone","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CognitoVerifyPhoneRequest"},"examples":{"default":{"summary":"Example request","value":{"verificationCode":"123456"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/cognito/verify-phone\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"123456\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/cognito/verify-phone', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"code\":\"123456\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/cognito/verify-phone',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"code\":\"123456\"}\n)\ndata = response.json()"}]}},"/api/contribution-templates/health":{"get":{"summary":"Contribution templates health check","description":"Returns health status of the contribution templates service. Returns 501 if CloudSQL is not enabled.","tags":["System"],"security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","service","status","ts"],"properties":{"ok":{"type":"boolean","example":true},"service":{"type":"string","example":"contribution-templates"},"status":{"type":"string","enum":["healthy","not_configured"],"example":"healthy"},"ts":{"type":"string","format":"date-time","description":"Timestamp of health check"},"configured":{"type":"boolean","example":true},"backend":{"type":"string","example":"postgres"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"501":{"description":"Service not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"service":{"type":"string","example":"contribution-templates"},"status":{"type":"string","example":"not_configured"},"message":{"type":"string","example":"CloudSQL not enabled"},"ts":{"type":"string","format":"date-time"}}}}}}},"operationId":"getContributionTemplatesHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/contribution-templates/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/contribution-templates/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/contribution-templates/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/costing/compute-age-rated":{"post":{"summary":"Compute age-rated costs","description":"Calculates costs using age-rated structure.","tags":["Costing"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plan"],"properties":{"plan":{"type":"object"},"contributionSettings":{"type":"object"},"context":{"type":"object"}}},"examples":{"default":{"summary":"Compute age-rated costs","value":{"members":[{"memberId":"M001","age":32,"relationship":"employee"},{"memberId":"M002","age":45,"relationship":"employee"},{"memberId":"M003","age":8,"relationship":"child","subscriberId":"M001"}],"ageRates":[{"minAge":0,"maxAge":17,"rate":185},{"minAge":18,"maxAge":34,"rate":385},{"minAge":35,"maxAge":54,"rate":525}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"result":{"type":"object"}}},"examples":{"success":{"summary":"Age-rated costs computed","value":{"ok":true,"totalMonthly":1095,"totalAnnual":13140,"memberCosts":[{"memberId":"M001","rate":385},{"memberId":"M002","rate":525},{"memberId":"M003","rate":185}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Plan required"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"computeAgeRatedCosts","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/compute-age-rated\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"members\":[],\"ageRates\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/compute-age-rated', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"members\":[],\"ageRates\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/compute-age-rated',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"members\":[],\"ageRates\":[]}\n)\ndata = response.json()"}]}},"/api/costing/compute-composite":{"post":{"summary":"Compute composite costs","description":"Calculates costs using composite tier structure.","tags":["Costing"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plan"],"properties":{"plan":{"type":"object"},"contributionSettings":{"type":"object"},"context":{"type":"object"}}},"examples":{"default":{"summary":"Compute composite costs","value":{"enrollment":{"employee":50,"employeeSpouse":20,"employeeChildren":15,"family":30},"rates":{"employee":650,"employeeSpouse":1200,"employeeChildren":1100,"family":1800}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"result":{"type":"object"}}},"examples":{"success":{"summary":"Composite costs computed","value":{"ok":true,"totalMonthly":127500,"totalAnnual":1530000,"byTier":{"employee":{"enrolled":50,"rate":650,"monthly":32500},"family":{"enrolled":30,"rate":1800,"monthly":54000}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Plan required"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"computeCompositeCosts","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/compute-composite\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"enrollment\":{},\"rates\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/compute-composite', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"enrollment\":{},\"rates\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/compute-composite',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"enrollment\":{},\"rates\":{}}\n)\ndata = response.json()"}]}},"/api/costing/health":{"get":{"summary":"Costing health check","description":"Returns costing API health status.","tags":["Costing"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"service":{"type":"string"},"timestamp":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getCostingHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/costing/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/costing/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/costing/scenario-compare":{"post":{"summary":"Compare cost scenarios","description":"Compares multiple scenarios against base case.","tags":["Costing"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["baseCase","scenarios"],"properties":{"baseCase":{"type":"object"},"scenarios":{"type":"array","maxItems":10},"options":{"type":"object"}}},"examples":{"default":{"summary":"Compare scenarios","value":{"scenarios":[{"name":"Current","rates":{"employee":650,"family":1800},"erContribution":{"employee":100,"family":75}},{"name":"Proposed","rates":{"employee":700,"family":1900},"erContribution":{"employee":100,"family":80}}],"enrollment":{"employee":50,"family":30}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"comparison":{"type":"object"}}},"examples":{"success":{"summary":"Scenarios compared","value":{"ok":true,"comparison":[{"name":"Current","erCostMonthly":73000,"eeCostMonthly":13500},{"name":"Proposed","erCostMonthly":80600,"eeCostMonthly":11400}],"delta":{"erCost":7600,"eeCost":-2100}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"compareScenarios","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/scenario-compare\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"scenarios\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/scenario-compare', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"scenarios\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/scenario-compare',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"scenarios\":[]}\n)\ndata = response.json()"}]}},"/api/costing/summarize":{"post":{"summary":"Summarize plan costs","description":"Calculates total costs across multiple plans.","tags":["Costing"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array"},"settings":{"type":"object"}}},"examples":{"default":{"summary":"Summarize plan costs","value":{"plans":[{"id":"plan1","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650},"family":{"enrolled":30,"rate":1800}}}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"totals":{"type":"object"},"perPlan":{"type":"object"},"warnings":{"type":"object"}}},"examples":{"success":{"summary":"Costs summarized","value":{"ok":true,"totalMonthly":86500,"totalAnnual":1038000,"totalEnrolled":80,"pepm":1081.25}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Plans required"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"summarizePlanCosts","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/costing/summarize\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/costing/summarize', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/costing/summarize',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[]}\n)\ndata = response.json()"}]}},"/api/email/proposal":{"post":{"summary":"Send proposal email","description":"Sends a benefit proposal email to specified recipients.","tags":["Email"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","subject","caseId"],"properties":{"to":{"type":"array","items":{"type":"string"},"description":"Recipient email addresses"},"cc":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"message":{"type":"string"},"caseId":{"type":"string"},"includeAttachment":{"type":"boolean","default":true},"attachmentType":{"type":"string","enum":["pdf","excel"]}}},"examples":{"default":{"summary":"Send proposal email","value":{"to":"client@example.com","subject":"Benefits Proposal - Acme Corp","caseId":"case-acme-2025","reportUrl":"https://app.trybart.com/reports/abc123","message":"Please review the attached benefits proposal."}}}}}},"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"messageId":{"type":"string"}}},"examples":{"success":{"summary":"Email sent","value":{"ok":true,"messageId":"msg_12345","sentAt":"2025-01-15T10:30:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Email send failed"}},"operationId":"sendProposalEmail","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/email/proposal\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"to\":\"client@example.com\",\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/email/proposal', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"to\":\"client@example.com\",\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/email/proposal',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"to\":\"client@example.com\",\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/enrollment-portal/sessions":{"post":{"summary":"Create enrollment session (v2)","description":"Broker-side endpoint to create a new enrollment session and provision per-employee magic-link forms. Toggles are derived from `sessionMode` defaults and merged with optional `toggleOverrides`. Each employee in the roster gets one row in `enrollment_forms` with a unique magic token used in the employee-facing magic-link URL.","tags":["Enrollment Portal"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sessionMode","payFrequency"],"properties":{"sessionMode":{"type":"string","enum":["quick-A","quick-B","quick-C","OE","new-hire"],"description":"Drives default toggle preset (verification level, allowed actions, frequency lock, etc.)."},"payFrequency":{"type":"integer","enum":[12,24,26,52],"description":"Annual pay periods. 12=monthly, 24=semi-monthly, 26=biweekly, 52=weekly."},"electionDeadline":{"type":"string","format":"date-time","description":"ISO-8601 datetime after which the form is locked. Used to derive the IRS contribution year for the public session payload."},"planData":{"type":"array","description":"Plan objects to present to employees. Shape mirrors the broker tool's plan payload.","items":{"type":"object"}},"employees":{"type":"array","description":"Employee roster. Each entry produces an `enrollment_forms` row with its own magic token.","items":{"type":"object","required":["firstName","lastName"],"properties":{"costs":{"type":"object","description":"Per-employee per-paycheck costs for age-rated roster plans, keyed by planId. Values failing validation are dropped silently.","additionalProperties":{"type":"object","required":["tier","premium","employer","employee"],"properties":{"tier":{"type":"string","enum":["employee","employeeSpouse","employeeChildren","family"]},"premium":{"type":"number","description":"Per pay period, rounded to cents."},"employer":{"type":"number","description":"Per pay period, rounded to cents."},"employee":{"type":"number","description":"Per pay period, rounded to cents."}}}},"firstName":{"type":"string"},"lastName":{"type":"string"},"dob":{"type":"string","format":"date","description":"Required when verificationLevel includes DOB challenge."},"ssn4":{"type":"string","minLength":4,"maxLength":4,"description":"Last four of SSN. Required when verificationLevel includes SSN4 challenge."}}}},"toggleOverrides":{"type":"object","description":"Partial overrides merged on top of the mode preset (later keys win). E.g. `{ verificationLevel: 'magic+dob' }`."}}},"example":{"sessionMode":"quick-B","payFrequency":26,"electionDeadline":"2026-12-15T23:59:00Z","planData":[],"employees":[{"firstName":"Jane","lastName":"Doe","dob":"1985-04-12","ssn4":"1234"}],"toggleOverrides":{"verificationLevel":"magic+dob"}}}}},"responses":{"201":{"description":"Session created.","content":{"application/json":{"schema":{"type":"object","required":["sessionId","toggles"],"properties":{"sessionId":{"type":"string","format":"uuid"},"toggles":{"type":"object","description":"Effective toggle set after merging mode defaults and overrides."}}},"example":{"sessionId":"8a3f1c2e-1d4b-4f1a-9b2c-7e0a8d5b3f12","toggles":{"verificationLevel":"magic+dob","allowDecline":true,"showCostMath":true}}}}},"400":{"description":"Invalid `sessionMode` or `payFrequency`.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}},"example":{"error":"invalid sessionMode"}}}},"500":{"description":"Server error during persistence.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}},"operationId":"postEnrollmentPortalSessions"},"get":{"summary":"List enrollment sessions visible to the caller","description":"Returns sessions with per-status counts (total/notOpened/opened/signed). Filter by status or scope.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["active","closed","deleted","all"]}},{"name":"scope","in":"query","schema":{"type":"string"},"description":"Filter scope (e.g., owned/org)"}],"responses":{"200":{"description":"Session list with per-status counts","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"sessions":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentPortalSessionSummary"}},"scope":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessions"}},"/api/enrollment-portal/sessions/{id}/public":{"get":{"summary":"Get public session payload","description":"Public, unauthenticated read of the session's renderable state — toggles, plan data, IRS limits for the deadline year. Safe to expose because it contains no employee PII; the per-employee identity is bound to the magic-link form, not this session payload.","tags":["Enrollment Portal"],"security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Session ID."}],"responses":{"200":{"description":"Public session payload.","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","format":"uuid"},"sessionMode":{"type":"string"},"toggles":{"type":"object"},"payFrequency":{"type":"integer"},"electionDeadline":{"type":"string","format":"date-time","nullable":true},"planData":{"type":"array","items":{"type":"object"}},"irsLimits":{"type":"object","description":"IRS contribution / out-of-pocket limits for the year derived from electionDeadline (or current year if absent)."}}}}}},"404":{"description":"Session not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}},"example":{"error":"not found"}}}}},"operationId":"getEnrollmentPortalSessionsIdPublic"}},"/api/enrollment-portal/forms/{formId}/verify-magic":{"post":{"summary":"Verify magic-link and start form session","description":"Employee-facing endpoint. Trades the one-time `token` (from the magic-link URL) plus an optional second-factor (currently `dob`) for an opaque `sessionToken` bound to this form. The session toggle `verificationLevel` controls whether DOB / SSN4 / OTP are required:\n\n- `magic-link` — token only.\n- `magic+dob` — token plus DOB.\n- `magic+ssn4` and `magic+ssn4+otp` — DOB still required by current handler; SSN4 / OTP enforcement is delegated to other endpoints in the flow.","tags":["Enrollment Portal"],"security":[],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Enrollment form ID (from the magic-link URL)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"Magic-link token from the URL."},"ssn4":{"type":"string","pattern":"^[0-9]{4}$","description":"Required at verificationLevel magic+ssn4 and magic+ssn4+otp; compared against the bcrypt hash at rest."},"otpCode":{"type":"string","pattern":"^[0-9]{6}$","description":"Second call at magic+ssn4+otp: the 6-digit code emailed after DOB and SSN-4 verified. Omit to send (or resend, at most once per minute) the code."},"dob":{"type":"string","format":"date","description":"Employee DOB. Required when the session's verificationLevel demands DOB."}}},"example":{"token":"RmFrZS1tYWdpYy10b2tlbg","dob":"1985-04-12"}}}},"responses":{"200":{"description":"Verified. Returns identity for greeting + sessionToken for subsequent calls.","content":{"application/json":{"schema":{"type":"object","properties":{"formId":{"type":"string","format":"uuid"},"sessionId":{"type":"string","format":"uuid"},"firstName":{"type":"string"},"lastName":{"type":"string"},"prefill":{"type":"object","nullable":true,"description":"Broker-supplied defaults for this employee. Null when none exist.","properties":{"demographics":{"type":"object","additionalProperties":true},"costs":{"type":"object","description":"Per-plan per-paycheck costs for this employee (age-rated roster plans), keyed by planId.","additionalProperties":{"type":"object","properties":{"tier":{"type":"string"},"premium":{"type":"number","description":"Per pay period, rounded to cents."},"employer":{"type":"number","description":"Per pay period, rounded to cents."},"employee":{"type":"number","description":"Per pay period, rounded to cents."}}}}}},"otpRequired":{"type":"boolean","description":"True when a one-time code was sent and sessionToken is withheld until it is verified."},"email":{"type":"string","description":"Masked delivery address for the one-time code, present with otpRequired."},"sessionToken":{"type":"string","description":"Pass as `X-Session-Token` header on follow-up requests (e.g. /elect)."}}}}}},"401":{"description":"Invalid token, missing DOB when required, or mismatched DOB.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}},"examples":{"invalidToken":{"value":{"error":"invalid token"}},"dobRequired":{"value":{"error":"dob required"}},"invalidDob":{"value":{"error":"invalid dob"}}}}}},"404":{"description":"Form not found.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}},"operationId":"postEnrollmentPortalFormsFormIdVerifyMagic"}},"/api/enrollment-portal/forms/{formId}/elect":{"post":{"summary":"Submit immutable elections","description":"Employee submits their final benefit elections and signature. Elections are immutable — once `signed_at` is set, subsequent submissions return 409. Server records IP + user-agent at top-level for the audit trigger; status is set to `'signed'` so reporting filters that scan WHERE status='signed' include v2 submissions. A receipt email is attempted but its failure does not block submission.","tags":["Enrollment Portal"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["elections","signature"],"properties":{"elections":{"type":"object","description":"Map of benefitType (e.g. `medical`, `dental`) to an election object. Each election is validated by `validateElection`.","additionalProperties":{"type":"object"}},"signature":{"type":"object","description":"Signature block validated by `validateSignature` — typically `{ name, signedAt, ip, userAgent }`."},"metadata":{"type":"object","description":"Optional client-side metadata; passed through `buildElectionPayload` and persisted as-is."}}}}}},"responses":{"200":{"description":"Elections recorded.","content":{"application/json":{"schema":{"type":"object","properties":{"elections":{"type":"object","description":"Canonical elections as stored. Accepted plan elections carry a server-computed deduction when the session priced that tier.","additionalProperties":{"type":"object","properties":{"decision":{"type":"string"},"planId":{"type":"string"},"tier":{"type":"string"},"deduction":{"type":"object","properties":{"premium":{"type":"number","description":"Per pay period, rounded to cents."},"employer":{"type":"number","description":"Per pay period, rounded to cents."},"employee":{"type":"number","description":"Per pay period, rounded to cents."}}}}}},"receiptId":{"type":"string","format":"uuid"}}}}}},"400":{"description":"Validation failed — `details` lists per-field / per-benefit errors.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"details":{"type":"array","items":{"type":"object"}}}},"example":{"error":"validation failed","details":[{"benefitType":"medical","errors":["missing planId"]}]}}}},"401":{"description":"Missing or wrong `X-Session-Token` header.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Form not found."},"409":{"description":"Form already signed; elections are immutable.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}},"example":{"error":"already signed; elections are immutable"}}}}},"operationId":"postEnrollmentPortalFormsFormIdElect"}},"/api/export/health":{"get":{"summary":"Export service health check","description":"Returns health status of the export service.","tags":["Export"],"security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","service","status","ts"],"properties":{"ok":{"type":"boolean","example":true},"service":{"type":"string","example":"export"},"status":{"type":"string","enum":["healthy","not_configured"],"example":"healthy"},"ts":{"type":"string","format":"date-time","description":"Timestamp of health check"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy","puppeteer":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getExportHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/export/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/export/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/export/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags":{"post":{"summary":"Create a new feature flag","description":"Creates a new feature flag with specified configuration. Admin access required.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["key","name"],"properties":{"key":{"type":"string","description":"Unique flag key","example":"dark-mode"},"name":{"type":"string","description":"Display name","example":"Dark Mode"},"description":{"type":"string","example":"Enable dark mode theme"},"defaultValue":{"type":"boolean","default":false},"enabled":{"type":"boolean","default":false},"rules":{"type":"array","items":{"type":"object"}},"tags":{"type":"array","items":{"type":"string"}},"targeting":{"type":"object"}}},"examples":{"default":{"summary":"Create feature flag","value":{"id":"new_dashboard","name":"New Dashboard","description":"Enable redesigned dashboard","defaultValue":false,"targetRules":[]}}}}}},"responses":{"200":{"description":"Feature flag created","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"flag":{"type":"object"}}},"examples":{"success":{"summary":"Flag created","value":{"ok":true,"flag":{"id":"new_dashboard","name":"New Dashboard","enabled":false,"createdAt":"2025-01-15T10:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid input or duplicate key"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createFeatureFlag","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/feature-flags\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"id\":\"new_feature\",\"name\":\"New Feature\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"id\":\"new_feature\",\"name\":\"New Feature\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/feature-flags',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"id\":\"new_feature\",\"name\":\"New Feature\"}\n)\ndata = response.json()"}]}},"/api/feature-flags/{flagId}":{"delete":{"summary":"Delete a feature flag","description":"Permanently deletes a feature flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Flag deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"message":{"type":"string","example":"Flag deleted"}}},"examples":{"success":{"summary":"Flag deleted","value":{"ok":true,"message":"Feature flag deleted"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deleteFeatureFlag","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"Get feature flag details","description":"Returns detailed information about a specific feature flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"The flag ID or key"}],"responses":{"200":{"description":"Flag details","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"flag":{"type":"object"}}},"examples":{"success":{"summary":"Flag details","value":{"ok":true,"flag":{"id":"new_dashboard","name":"New Dashboard","description":"Enable redesigned dashboard","defaultValue":false,"targetRules":[{"type":"user","ids":["user123"],"value":true}],"createdAt":"2025-01-10T10:00:00Z","updatedAt":"2025-01-15T14:30:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlag","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update a feature flag","description":"Updates an existing feature flag configuration.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"enabled":{"type":"boolean"},"defaultValue":{"type":"boolean"},"rules":{"type":"array","items":{"type":"object"}},"tags":{"type":"array","items":{"type":"string"}},"targeting":{"type":"object"}}},"examples":{"default":{"summary":"Update flag","value":{"defaultValue":true,"description":"Updated description"}}}}}},"responses":{"200":{"description":"Flag updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"flag":{"type":"object"}}},"examples":{"success":{"summary":"Flag updated","value":{"ok":true,"flag":{"id":"new_dashboard","defaultValue":true,"updatedAt":"2025-01-15T15:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid input"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"updateFeatureFlag","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"defaultValue\":true}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"defaultValue\":true})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"defaultValue\":true}\n)\ndata = response.json()"}]}},"/api/feature-flags/{flagId}/dependencies":{"get":{"summary":"Get feature flag dependencies","description":"Returns flags that depend on this flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Flag dependencies","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"dependencies":{"type":"array","items":{"type":"object"}},"dependents":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"Flag dependencies","value":{"ok":true,"dependencies":{"dependsOn":["base_feature"],"dependedBy":["advanced_feature"]}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlagDependencies","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID/dependencies\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID/dependencies', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID/dependencies',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/{flagId}/history":{"get":{"summary":"Get feature flag change history","description":"Returns the change history for a specific flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Change history","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"history":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time"},"userId":{"type":"string"},"action":{"type":"string"},"changes":{"type":"object"}}}}}},"examples":{"success":{"summary":"Flag history","value":{"ok":true,"history":[{"action":"updated","field":"defaultValue","oldValue":false,"newValue":true,"userId":"user123","timestamp":"2025-01-15T14:30:00Z"},{"action":"created","userId":"user456","timestamp":"2025-01-10T10:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlagHistory","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID/history\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID/history', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID/history',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/{flagId}/usage":{"get":{"summary":"Get feature flag usage statistics","description":"Returns usage statistics for a specific flag.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"flagId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"Usage statistics","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"usage":{"type":"object","properties":{"evaluations":{"type":"integer"},"trueCount":{"type":"integer"},"falseCount":{"type":"integer"},"uniqueUsers":{"type":"integer"}}}}},"examples":{"success":{"summary":"Flag usage","value":{"ok":true,"usage":{"totalEvaluations":15420,"last24h":542,"trueCount":8500,"falseCount":6920,"byUser":{"unique":125}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"404":{"description":"Flag not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlagUsage","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/EXAMPLE_ID/usage\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/EXAMPLE_ID/usage', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/EXAMPLE_ID/usage',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/bulk":{"post":{"summary":"Bulk feature flag operations","description":"Perform bulk operations on multiple feature flags.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["operation","flagIds"],"properties":{"operation":{"type":"string","enum":["enable","disable","delete"]},"flagIds":{"type":"array","items":{"type":"string"}}}},"examples":{"default":{"summary":"Bulk operations","value":{"operations":[{"action":"enable","flagId":"flag1"},{"action":"disable","flagId":"flag2"}]}}}}}},"responses":{"200":{"description":"Bulk operation completed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"updated":{"type":"integer"},"errors":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"Bulk completed","value":{"ok":true,"results":[{"flagId":"flag1","success":true},{"flagId":"flag2","success":true}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid operation or flag IDs"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"bulkFeatureFlagOperation","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/feature-flags/bulk\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"operations\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/bulk', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"operations\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/feature-flags/bulk',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"operations\":[]}\n)\ndata = response.json()"}]}},"/api/feature-flags/list":{"get":{"summary":"List all feature flags","description":"Returns paginated list of all feature flags. Admin access required.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"},{"name":"search","in":"query","schema":{"type":"string"},"description":"Search query string"},{"name":"tag","in":"query","schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"enabled","in":"query","schema":{"type":"boolean"},"description":"Query parameter for filtering or options"}],"responses":{"200":{"description":"List of feature flags","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"flags":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"examples":{"success":{"summary":"All flags","value":{"ok":true,"flags":[{"id":"new_dashboard","name":"New Dashboard","defaultValue":true},{"id":"ai_parsing","name":"AI Parsing","defaultValue":false}],"total":2}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listFeatureFlags","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/list\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/list', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/list',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/my-features":{"get":{"summary":"Get feature flags for current user","description":"Returns evaluated feature flags for the authenticated user.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"User feature flags","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"features":{"type":"object","additionalProperties":{"type":"boolean"}},"evaluatedAt":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"User features","value":{"ok":true,"features":{"new_dashboard":true,"ai_parsing":false,"beta_exports":true}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getMyFeatures","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/my-features\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/my-features', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/my-features',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/refresh-cache":{"post":{"summary":"Refresh feature flag cache","description":"Clears and reloads the feature flag cache from the database.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Cache refreshed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"message":{"type":"string","example":"Cache refreshed"},"flagCount":{"type":"integer"}}},"examples":{"success":{"summary":"Cache refreshed","value":{"ok":true,"message":"Feature flag cache refreshed","flagCount":15}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"refreshFeatureFlagCache","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/feature-flags/refresh-cache\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/refresh-cache', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/feature-flags/refresh-cache',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{}}}}}},"/api/feature-flags/stats":{"get":{"summary":"Get feature flag statistics","description":"Returns aggregate statistics for all feature flags.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Flag statistics","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"stats":{"type":"object","properties":{"totalFlags":{"type":"integer"},"enabledFlags":{"type":"integer"},"disabledFlags":{"type":"integer"},"byTag":{"type":"object","additionalProperties":{"type":"integer"}}}}}},"examples":{"success":{"summary":"Flag stats","value":{"ok":true,"stats":{"totalFlags":15,"enabledFlags":8,"disabledFlags":7,"evaluationsToday":5420}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlagStats","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/feature-flags/sync-defaults":{"post":{"summary":"Sync default feature flags","description":"Synchronizes default flags from configuration to the database.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Defaults synced","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"synced":{"type":"integer"},"created":{"type":"integer"},"updated":{"type":"integer"}}},"examples":{"success":{"summary":"Defaults synced","value":{"ok":true,"synced":5,"created":2,"updated":3}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"syncDefaultFeatureFlags","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/feature-flags/sync-defaults\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/sync-defaults', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/feature-flags/sync-defaults',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}},"example":{}}}}}},"/api/feature-flags/templates":{"get":{"summary":"Get feature flag templates","description":"Returns predefined templates for common flag configurations.","tags":["Feature Flags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Flag templates","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"templates":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"summary":"Flag templates","value":{"ok":true,"templates":[{"id":"percentage_rollout","name":"Percentage Rollout","description":"Gradually roll out to percentage of users"},{"id":"user_whitelist","name":"User Whitelist","description":"Enable for specific users"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Admin access required"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getFeatureFlagTemplates","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/feature-flags/templates\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/feature-flags/templates', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/feature-flags/templates',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/{provider}/connect":{"post":{"summary":"Connect to integration provider","description":"Establishes a connection to an external integration provider.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","enum":["salesforce","hubspot","slack"]},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"authCode":{"type":"string","description":"OAuth authorization code"},"redirectUri":{"type":"string"},"state":{"type":"string"}}},"examples":{"default":{"summary":"Connect integration","value":{"apiKey":"sk_live_...","settings":{"syncInterval":"daily"}}}}}}},"responses":{"200":{"description":"Connected successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"connected":{"type":"boolean","example":true},"provider":{"type":"string"}}},"examples":{"success":{"summary":"Connected","value":{"ok":true,"connected":true,"provider":"salesforce","connectedAt":"2025-01-15T10:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid auth code"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"connectIntegration","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/EXAMPLE_ID/connect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"credentials\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/EXAMPLE_ID/connect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"credentials\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/EXAMPLE_ID/connect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"credentials\":{}}\n)\ndata = response.json()"}]}},"/api/integrations/{provider}/disconnect":{"post":{"summary":"Disconnect an integration","description":"Disconnects an integration for the org.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationDisconnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"disconnected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_{provider}_disconnect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","description":"Associated organization ID"}}},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/EXAMPLE_ID/disconnect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/EXAMPLE_ID/disconnect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/EXAMPLE_ID/disconnect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/{provider}/test":{"post":{"summary":"Test integration connection","description":"Validates stored credentials and returns provider status.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationTestResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"success":true,"latency":150}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_{provider}_test","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","description":"Associated organization ID"}}},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/EXAMPLE_ID/test\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/EXAMPLE_ID/test', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/EXAMPLE_ID/test',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/connect":{"post":{"summary":"Connect to a ben-admin provider","description":"Establishes a connection to a ben-admin platform using OAuth or API key credentials.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminConnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"connected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_benadmin_{provider}_connect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminConnectRequest"},"examples":{"default":{"summary":"Example request","value":{"apiKey":"xxx","companyId":"xxx"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/connect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"credentials\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/connect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"credentials\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/connect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"credentials\":{}}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/disconnect":{"post":{"summary":"Disconnect from a ben-admin provider","description":"Revokes the connection to a ben-admin platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminDisconnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"disconnected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_benadmin_{provider}_disconnect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminDisconnectRequest"},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/disconnect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/disconnect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/disconnect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/enrollment":{"post":{"summary":"Post enrollment elections to ben-admin","description":"Submits employee enrollment elections to the ben-admin platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminEnrollmentResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"enrollmentId":"enr_xyz","status":"processing"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_benadmin_{provider}_enrollment","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminEnrollmentRequest"},"examples":{"default":{"summary":"Example request","value":{"groupId":"grp_123","effectiveDate":"2025-01-01"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"groupId\":\"group-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"groupId\":\"group-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"groupId\":\"group-123\"}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/enrollment-status":{"get":{"summary":"Get enrollment status from ben-admin","description":"Retrieves enrollment status for employees from the ben-admin platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminEnrollmentStatusResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"enrollments":[{"id":"enr_1","status":"completed","submittedAt":"2025-01-15T00:00:00Z"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_benadmin_{provider}_enrollmentstatus","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Ben-admin provider identifier (e.g., ease, employee-navigator)"},{"name":"groupId","in":"query","required":true,"schema":{"type":"string"},"description":"Employer group identifier"},{"name":"employeeIds","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of employee IDs to filter"},{"name":"planYear","in":"query","required":false,"schema":{"type":"integer"},"description":"Plan year to filter"},{"name":"benefitTypes","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of benefit types to filter"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment-status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment-status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/enrollment-status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/groups":{"get":{"summary":"List employer groups from ben-admin","description":"Retrieves a paginated list of employer groups from the ben-admin platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminGroupsResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"groups":[{"id":"grp_1","name":"Acme Corp","employeeCount":150}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_benadmin_{provider}_groups","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Ben-admin provider identifier"},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Search term to filter groups by name"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"description":"Number of results per page"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0},"description":"Offset for pagination"},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","inactive","pending"]},"description":"Filter by group status"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/groups/{groupId}":{"get":{"summary":"Get group details from ben-admin","description":"Retrieves detailed information for a specific employer group including census, plans, and rates.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminGroupDetailResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"group":{"id":"grp_1","name":"Acme Corp","plans":[{"id":"plan_1","name":"PPO Gold"}]}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_benadmin_{provider}_groups_{groupId}","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Ben-admin provider identifier"},{"name":"groupId","in":"path","required":true,"schema":{"type":"string"},"description":"Group identifier"},{"name":"includeCensus","in":"query","required":false,"schema":{"type":"boolean","default":true},"description":"Include employee census data"},{"name":"includePlans","in":"query","required":false,"schema":{"type":"boolean","default":true},"description":"Include benefit plans"},{"name":"includeRates","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Include rate information"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/groups/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/status":{"get":{"summary":"Get ben-admin connection status","description":"Returns connection status for a ben-admin provider.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"connected":{"type":"boolean","description":"Whether connected"},"accountId":{"type":"string","nullable":true,"description":"External account identifier"},"accountName":{"type":"string","nullable":true,"description":"External account display name"},"connectedAt":{"type":"string","format":"date-time","nullable":true,"description":"Connection timestamp"},"lastSyncedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last sync timestamp"}},"required":["success","connected"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"connected":true,"lastSync":"2025-01-15T00:00:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_benadmin_{provider}_status","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/{provider}/sync-plans":{"post":{"summary":"Sync plans with ben-admin","description":"Synchronizes benefit plans between Planlined and the ben-admin platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminSyncPlansResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"plansSynced":5}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_benadmin_{provider}_syncplans","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenAdminSyncPlansRequest"},"examples":{"default":{"summary":"Example request","value":{"groupId":"grp_123"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/sync-plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planIds\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/sync-plans', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planIds\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/benadmin/EXAMPLE_ID/sync-plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planIds\":[]}\n)\ndata = response.json()"}]}},"/api/integrations/benadmin/providers":{"get":{"summary":"List ben-admin providers","description":"Returns available ben-admin integration providers.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationProviderListResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"providers":[{"id":"ease","name":"EASE","connected":true},{"id":"employee-navigator","name":"Employee Navigator","connected":false}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_benadmin_providers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/benadmin/providers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/benadmin/providers', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/benadmin/providers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/catalog":{"get":{"summary":"Get integration catalog","description":"Returns provider catalog with connection status for the org.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationCatalogResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"integrations":[{"id":"salesforce","name":"Salesforce","category":"crm","description":"Sync cases and contacts with Salesforce CRM","features":["contact-sync","case-sync","activity-logging"],"status":"available"},{"id":"hubspot","name":"HubSpot","category":"crm","description":"Connect with HubSpot for deal and contact management","features":["contact-sync","deal-sync"],"status":"available"},{"id":"slack","name":"Slack","category":"communication","description":"Send notifications and updates to Slack channels","features":["notifications","case-alerts"],"status":"available"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_catalog","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/catalog\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/catalog', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/catalog',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/connect":{"post":{"summary":"Connect to a CRM provider","description":"Establishes a connection to a CRM platform using OAuth credentials.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMConnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"connected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_connect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMConnectRequest"},"examples":{"default":{"summary":"Example request","value":{"instanceUrl":"https://xxx.salesforce.com","accessToken":"xxx"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/connect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"apiKey\":\"key\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/connect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"apiKey\":\"key\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/connect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"apiKey\":\"key\"}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/disconnect":{"post":{"summary":"Disconnect from a CRM provider","description":"Revokes the connection to a CRM platform.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMDisconnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"disconnected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_disconnect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMDisconnectRequest"},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/disconnect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/disconnect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/disconnect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/log-activity":{"post":{"summary":"Log an activity to CRM","description":"Creates an activity record (note, call, email, meeting, or task) in the CRM system.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMLogActivityResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"activityId":"act_xyz"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_logactivity","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMLogActivityRequest"},"examples":{"default":{"summary":"Example request","value":{"contactId":"cnt_123","type":"call","notes":"Discussed renewal options"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/log-activity\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"activity\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/log-activity', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"activity\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/log-activity',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"activity\":{}}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/status":{"get":{"summary":"Get CRM connection status","description":"Returns connection status for a CRM provider.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"connected":{"type":"boolean","description":"Whether connected"},"accountId":{"type":"string","nullable":true,"description":"External account identifier"},"accountName":{"type":"string","nullable":true,"description":"External account display name"},"connectedAt":{"type":"string","format":"date-time","nullable":true,"description":"Connection timestamp"},"lastSyncedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last sync timestamp"}},"required":["success","connected"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"connected":true,"user":"admin@company.com"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_crm_{provider}_status","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/sync-case":{"post":{"summary":"Sync a Planlined case to CRM","description":"Synchronizes a complete Planlined case to CRM, including contacts, company, and deal.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncCaseResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"synced":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_synccase","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncCaseRequest"},"examples":{"default":{"summary":"Example request","value":{"caseId":"case-acme-2025","opportunityId":"opp_123"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-case\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-case', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-case',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/sync-contact":{"post":{"summary":"Sync a contact to CRM","description":"Creates or updates a contact in the CRM system.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncContactResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"contactId":"cnt_new123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_synccontact","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncContactRequest"},"examples":{"default":{"summary":"Example request","value":{"email":"client@example.com","name":"John Client"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-contact\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"contact\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-contact', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"contact\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-contact',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"contact\":{}}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/sync-deal":{"post":{"summary":"Sync a deal/opportunity to CRM","description":"Creates or updates a deal/opportunity in the CRM system.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncDealResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"dealId":"deal_xyz"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_syncdeal","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMSyncDealRequest"},"examples":{"default":{"summary":"Example request","value":{"caseId":"case-acme-2025","dealName":"Acme Renewal 2025"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-deal\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"deal\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-deal', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"deal\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/sync-deal',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"deal\":{}}\n)\ndata = response.json()"}]}},"/api/integrations/crm/{provider}/upload-file":{"post":{"summary":"Upload a file to CRM","description":"Uploads a file attachment to a CRM record.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMUploadFileResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"fileId":"file_crm_123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_crm_{provider}_uploadfile","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CRMUploadFileRequest"},"examples":{"default":{"summary":"Example request","value":{"recordId":"opp_123","filename":"proposal.pdf","data":"BASE64"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/upload-file\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/upload-file', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/crm/EXAMPLE_ID/upload-file',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/crm/providers":{"get":{"summary":"List CRM providers","description":"Returns available CRM integration providers.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationProviderListResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"providers":[{"id":"salesforce","name":"Salesforce","connected":true},{"id":"hubspot","name":"HubSpot","connected":false}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_crm_providers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/crm/providers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/crm/providers', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/crm/providers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/authorize":{"get":{"summary":"Initiate OAuth authorization flow","description":"Redirects the user to the OAuth provider's authorization page. This is a redirect endpoint, not a JSON API.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"content":{"application/json":{"examples":{"success":{"summary":"Auth URL","value":{"ok":true,"authUrl":"https://login.salesforce.com/services/oauth2/authorize?client_id=...&redirect_uri=..."}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"authUrl":{"type":"string","format":"uri"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}},"description":"Authorization URL generated"},"302":{"description":"Redirects to OAuth provider authorization page"},"400":{"description":"Unknown provider or missing required context (subdomain/tenant)"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Provider not configured (missing credentials)"}},"operationId":"get_api_integrations_oauth_{provider}_authorize","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"OAuth provider identifier (e.g., google-drive, hubspot, salesforce)"},{"name":"returnUrl","in":"query","required":false,"schema":{"type":"string"},"description":"URL to redirect to after successful authorization"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization ID to associate with the connection"},{"name":"subdomain","in":"query","required":false,"schema":{"type":"string"},"description":"Subdomain for providers that require it"},{"name":"tenant","in":"query","required":false,"schema":{"type":"string"},"description":"Tenant ID for providers that require it"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/authorize\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/authorize', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/authorize',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/callback":{"get":{"summary":"Handle OAuth callback","description":"Handles the OAuth callback from the provider, exchanges the authorization code for tokens, and stores the connection.","tags":["Integrations"],"security":[],"responses":{"200":{"content":{"application/json":{"examples":{"success":{"summary":"OAuth callback","value":{"ok":true,"connected":true,"provider":"hubspot","accessToken":"pat-...","refreshToken":"ref-..."}}},"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"connected":{"type":"boolean"},"provider":{"type":"string"},"accessToken":{"type":"string"},"refreshToken":{"type":"string"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}},"description":"OAuth callback handled successfully"},"302":{"description":"Redirect to success or error page based on authorization result"},"400":{"description":"Invalid state or provider mismatch"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_oauth_{provider}_callback","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"OAuth provider identifier"},{"name":"code","in":"query","required":false,"schema":{"type":"string"},"description":"Authorization code from the OAuth provider"},{"name":"state","in":"query","required":true,"schema":{"type":"string"},"description":"Encrypted state parameter containing session data"},{"name":"error","in":"query","required":false,"schema":{"type":"string"},"description":"Error code if authorization failed"},{"name":"error_description","in":"query","required":false,"schema":{"type":"string"},"description":"Human-readable error description"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/callback\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/callback', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/callback',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/disconnect":{"post":{"summary":"Disconnect an OAuth provider","description":"Revokes the OAuth connection for a provider.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthDisconnectResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"disconnected":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_oauth_{provider}_disconnect","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthDisconnectRequest"},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/disconnect\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/disconnect', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/disconnect',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/exchange":{"post":{"summary":"Exchange authorization code for tokens","description":"Exchanges an authorization code from Google Identity Services for OAuth tokens.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthExchangeResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"accessToken":"xxx","refreshToken":"xxx"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_oauth_{provider}_exchange","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthExchangeRequest"},"examples":{"default":{"summary":"Example request","value":{"code":"xxx","redirectUri":"https://app.trybart.com/callback"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/exchange\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"code\":\"auth_code\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/exchange', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"code\":\"auth_code\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/exchange',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"code\":\"auth_code\"}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/refresh":{"post":{"summary":"Refresh OAuth tokens","description":"Refreshes expired OAuth tokens using the stored refresh token.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthRefreshResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"accessToken":"xxx_new"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_integrations_oauth_{provider}_refresh","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthRefreshRequest"},"examples":{"default":{"summary":"Example request","value":{"refreshToken":"xxx"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/refresh\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/refresh', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/refresh',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/{provider}/url":{"get":{"summary":"Get OAuth authorization URL","description":"Returns the OAuth authorization URL for the provider.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOAuthUrlResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"url":"https://accounts.google.com/oauth/authorize?..."}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Unknown provider or invalid context"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Provider not configured"}},"operationId":"get_api_integrations_oauth_{provider}_url","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"returnUrl","in":"query","required":false,"schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/url\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/url', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/oauth/EXAMPLE_ID/url',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/oauth/providers":{"get":{"summary":"List OAuth providers","description":"Returns OAuth provider configuration and readiness.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationOAuthProvidersResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"providers":[{"id":"google","name":"Google","connected":true},{"id":"microsoft","name":"Microsoft","connected":false}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_oauth_providers","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/oauth/providers\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/oauth/providers', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/oauth/providers',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/integrations/providers/definitions":{"get":{"summary":"List integration provider definitions","description":"Returns static provider definitions used by the UI catalog.","tags":["Integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationProvidersResponse"},"examples":{"success":{"value":{"success":true,"providers":[{"id":"employee-navigator","name":"Employee Navigator","description":"Sync plans, census, and enrollments with Employee Navigator.","category":"benadmin","authType":"oauth","dataAccess":{"read":["Groups","Census"],"write":["Plans"]}}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_integrations_providers_definitions","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/integrations/providers/definitions\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/integrations/providers/definitions', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/integrations/providers/definitions',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/market/snapshot":{"get":{"summary":"Get market snapshot data","description":"Retrieves market benchmark data for a specific city/state and industry. Returns average premium, median enrollment, and industry ranking. Data is deterministically generated based on location/industry parameters.","tags":["Market Data"],"security":[],"parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string"},"description":"City name","example":"San Francisco"},{"name":"state","in":"query","schema":{"type":"string"},"description":"State name or abbreviation","example":"CA"},{"name":"industry","in":"query","required":true,"schema":{"type":"string"},"description":"Industry category","example":"technology"}],"responses":{"200":{"description":"Market snapshot retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","data"],"properties":{"ok":{"type":"boolean","example":true},"data":{"type":"object","properties":{"avgPremium":{"type":"number","description":"Average monthly premium in dollars","example":650},"medianEnrollment":{"type":"number","description":"Median enrollment percentage","example":75},"industryRank":{"type":"string","enum":["Below Average","Average","Above Average"],"example":"Above Average"}}}}},"examples":{"success":{"summary":"Market snapshot","value":{"ok":true,"snapshot":{"date":"2025-01-15","medicalTrend":0.072,"dentalTrend":0.045,"visionTrend":0.032,"avgPremiumIncrease":0.068,"dataPoints":15000}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"missing_parameters"},"message":{"type":"string","example":"city and industry are required"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"}}}}}}},"operationId":"getMarketSnapshot","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/market/snapshot\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/market/snapshot', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/market/snapshot',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/market/trends":{"get":{"summary":"Get market trend data","description":"Retrieves benefit adoption trends for a specific city/state and industry. Returns coverage adoption percentages for medical, dental, vision, life, and disability insurance.","tags":["Market Data"],"security":[],"parameters":[{"name":"city","in":"query","required":true,"schema":{"type":"string"},"description":"City name","example":"San Francisco"},{"name":"state","in":"query","schema":{"type":"string"},"description":"State name or abbreviation","example":"CA"},{"name":"industry","in":"query","required":true,"schema":{"type":"string"},"description":"Industry category","example":"technology"}],"responses":{"200":{"description":"Market trends retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","data"],"properties":{"ok":{"type":"boolean","example":true},"data":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","description":"Coverage type label","example":"Medical Coverage Adoption"},"value":{"type":"number","description":"Adoption percentage (20-100)","example":85},"color":{"type":"string","description":"CSS color class for visualization","example":"bg-blue-500"}}},"example":[{"label":"Medical Coverage Adoption","value":85,"color":"bg-blue-500"},{"label":"Dental Coverage Adoption","value":70,"color":"bg-cyan-500"},{"label":"Vision Coverage Adoption","value":55,"color":"bg-indigo-500"}]}}},"examples":{"success":{"summary":"Market trends","value":{"ok":true,"trends":[{"year":2024,"medicalTrend":0.068,"dentalTrend":0.042},{"year":2025,"medicalTrend":0.072,"dentalTrend":0.045}],"forecast":{"2026":{"medicalTrend":0.075}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing required parameters"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error"}},"operationId":"getMarketTrends","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/market/trends\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/market/trends', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/market/trends',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations":{"post":{"summary":"Create a new organization","description":"Creates a new organization with the authenticated user as owner.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Organization created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"type":"object","description":"The created organization","properties":{"id":{"type":"string","description":"Organization ID"},"name":{"type":"string","description":"Organization name"},"description":{"type":"string","description":"Organization description"},"owner_id":{"type":"string","description":"Owner user ID"},"billing_email":{"type":"string","format":"email","description":"Billing email"},"max_users":{"type":"integer","description":"Maximum number of users"},"tier":{"type":"string","enum":["free","enterprise"],"description":"Organization tier"},"created_at":{"type":"string","format":"date-time","description":"When the organization was created"}}}},"required":["ok","organization"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organization":{"id":"org_new123","name":"Benefits Consulting Group","slug":"bcg","ownerId":"user_abc123","memberCount":1,"createdAt":"2025-01-15T10:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"createOrganization","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255,"description":"Organization name (required)"},"description":{"type":"string","maxLength":1000,"description":"Organization description"},"billing_email":{"type":"string","format":"email","description":"Billing email address"},"max_users":{"type":"integer","minimum":1,"maximum":100000,"default":10,"description":"Maximum number of users"},"tier":{"type":"string","enum":["free","enterprise"],"default":"free","description":"Organization tier"}},"required":["name"]},"examples":{"default":{"summary":"Create organization","value":{"name":"Acme Benefits Consulting","slug":"acme-benefits"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"My Organization\",\"slug\":\"my-org\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({ name: 'My Organization', slug: 'my-org' })\n});\nconst { organization } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={'name': 'My Organization', 'slug': 'my-org'}\n)\norganization = response.json()['organization']"}]}},"/api/organizations/{orgId}/dev/add-self":{"post":{"summary":"[DEV] Add self as team member","description":"Development-only endpoint to add the current user as a team member to an organization. Not available in production.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Member added successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"alreadyMember":{"type":"boolean","description":"True if user was already a member"},"member":{"type":"object","description":"The team member record","properties":{"user_id":{"type":"string","description":"User ID"},"org_id":{"type":"string","description":"Organization ID"},"role":{"type":"string","enum":["viewer","editor","admin","owner"],"description":"Member role"}}}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Added to organization"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"devAddSelfToOrg","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","editor","admin"],"description":"Role to assign (defaults to admin)"}}},"examples":{"default":{"summary":"Add self to org","value":{"role":"member"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/EXAMPLE_ID/dev/add-self\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"role\":\"member\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/dev/add-self', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"role\":\"member\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/dev/add-self',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"role\":\"member\"}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/invitations/{inviteId}":{"delete":{"summary":"Cancel an invitation","description":"Cancels a pending invitation. Requires owner or admin role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Invitation cancelled successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"message":{"type":"string","description":"Confirmation message"}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Invitation cancelled"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Invitation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"cancelOrgInvitation","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"inviteId","in":"path","required":true,"schema":{"type":"string"},"description":"Invitation unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/invitations/{inviteId}/resend":{"post":{"summary":"Resend an invitation email","description":"Resends the invitation email to the invitee. Requires owner or admin role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Invitation expiry extended and email delivery attempted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationInvitationResendResponse"},"examples":{"success":{"summary":"Invitation resent and email delivered","value":{"ok":true,"invitation":{"external_id":"inv_abc123","org_id":"org_xyz789","email":"teammate@example.com","role":"viewer","token":"invitation-token","expires_at":"2026-08-01T12:00:00.000Z"},"token":"invitation-token","emailSent":true,"emailMessageId":"message-123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invitation cannot be resent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requester is not an organization member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Invitation resend failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Invitation persistence is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"operationId":"resendOrgInvitation","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"inviteId","in":"path","required":true,"schema":{"type":"string"},"description":"Invitation unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID/resend\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID/resend', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/invitations/EXAMPLE_ID/resend',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/organizations/{orgId}/members/{targetUserId}":{"delete":{"summary":"Remove a team member","description":"Removes a member from the organization. Cannot remove the owner. Requires owner or admin role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Member removed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"message":{"type":"string","description":"Confirmation message"}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Member removed"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Cannot remove organization owner","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"removeOrgMember","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"targetUserId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update member role","description":"Updates a team member's role in the organization. Requires owner or admin role.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Role updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"message":{"type":"string","description":"Confirmation message"}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"message":"Role updated"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid role","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"updateOrgMemberRole","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"targetUserId","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["viewer","editor","admin"],"description":"New role to assign"}},"required":["role"]},"examples":{"default":{"summary":"Update member role","value":{"role":"admin"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"role\":\"admin\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"role\":\"admin\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/organizations/EXAMPLE_ID/members/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"role\":\"admin\"}\n)\ndata = response.json()"}]}},"/api/organizations/accept":{"post":{"summary":"Accept organization invitation","description":"Accepts an invitation to join an organization using the invitation token.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Invitation accepted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"organization":{"type":"object","description":"The joined organization","properties":{"id":{"type":"string","description":"Organization ID"},"name":{"type":"string","description":"Organization name"}}}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"organizationId":"org_abc","role":"member"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid or missing token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"acceptOrgInvitation","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"Invitation token from the invite email"}},"required":["token"]},"examples":{"default":{"summary":"Accept invitation","value":{"invitationToken":"inv_abc123xyz"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/organizations/accept\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"token\":\"inv_123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/accept', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"token\":\"inv_123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/organizations/accept',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"token\":\"inv_123\"}\n)\ndata = response.json()"}]}},"/api/organizations/user/profile":{"get":{"summary":"Get current user profile","description":"Returns the profile of the currently authenticated user.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Profile retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"profile":{"type":"object","description":"User profile","properties":{"user_id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"Email address"},"display_name":{"type":"string","description":"Display name"},"primary_org_id":{"type":"string","description":"Primary organization ID"},"created_at":{"type":"string","format":"date-time","description":"When the profile was created"}}}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"profile":{"userId":"user_123","orgRole":"member","joinedAt":"2025-01-01T00:00:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getOrganizationsUserProfile","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/organizations/user/profile\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/user/profile', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/organizations/user/profile',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update current user profile","description":"Updates the profile of the currently authenticated user.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Profile updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"profile":{"type":"object","description":"Updated user profile","properties":{"user_id":{"type":"string","description":"User ID"},"email":{"type":"string","format":"email","description":"Email address"},"display_name":{"type":"string","description":"Display name"},"primary_org_id":{"type":"string","description":"Primary organization ID"}}}},"required":["ok"]},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"profile":{"displayName":"John Smith","title":"Benefits Analyst"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"updateUserProfile","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"display_name":{"type":"string","description":"Display name"},"primary_org_id":{"type":"string","description":"Primary organization ID"}}},"examples":{"default":{"summary":"Update profile","value":{"displayName":"John Smith","title":"Senior Benefits Consultant","phone":"555-123-4567"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/organizations/user/profile\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"displayName\":\"John Smith\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/organizations/user/profile', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"displayName\":\"John Smith\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/organizations/user/profile',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"displayName\":\"John Smith\"}\n)\ndata = response.json()"}]}},"/api/parse/learned":{"delete":{"summary":"Delete the authenticated user's advisory correction","description":"Deletes the authenticated user's advisory correction for the carrier, benefitType, and fieldId combination.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"carrier","in":"query","required":true,"schema":{"type":"string"},"description":"Carrier name (e.g., UHC, Aetna, Cigna)","example":"UHC"},{"name":"benefitType","in":"query","required":true,"schema":{"type":"string"},"description":"Benefit type","example":"medical"},{"name":"fieldId","in":"query","required":true,"schema":{"type":"string"},"description":"Field identifier for the fix","example":"deductible_individual"}],"responses":{"200":{"description":"Advisory correction deleted successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","deleted"],"properties":{"ok":{"type":"boolean","example":true},"deleted":{"type":"boolean","description":"Whether the fix was found and deleted","example":true}}},"examples":{"success":{"summary":"Advisory correction deleted","value":{"ok":true,"deleted":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"missing_params"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Database not configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"database_not_configured"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"501":{"description":"Feature not implemented","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_implemented"}}}}}}},"operationId":"deleteLearnedFix","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/parse/learned\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/parse/learned', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/parse/learned',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"List advisory corrections for the authenticated user","description":"Retrieves the authenticated user's advisory corrections for a specific carrier and benefit type. Returns a map of fieldId to corrected values; the values are not applied to live parses until separately replay-approved.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"carrier","in":"query","required":true,"schema":{"type":"string"},"description":"Carrier name (e.g., UHC, Aetna, Cigna)","example":"UHC"},{"name":"benefitType","in":"query","schema":{"type":"string","default":"medical"},"description":"Benefit type filter","example":"medical"}],"responses":{"200":{"description":"Advisory corrections retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","items"],"properties":{"ok":{"type":"boolean","example":true},"items":{"type":"object","additionalProperties":{"type":"string"},"description":"Map of fieldId to advisory corrected value; never applied until replay-approved","example":{"deductible_individual":"$1,500","oop_max_family":"$6,000"}}}},"examples":{"success":{"summary":"Advisory corrections retrieved","value":{"ok":true,"items":{"deductible_individual":"$1,500","deductible_family":"$3,000","oop_max_individual":"$6,000","oop_max_family":"$12,000"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing carrier parameter","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"missing_carrier"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listLearnedFixes","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/parse/learned\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/parse/learned', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/parse/learned',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"post":{"summary":"Save a user-scoped advisory correction","description":"Creates or updates a user-scoped advisory correction for replay and review. It is not applied to live parses until separately replay-approved.","tags":["Parse"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["carrier","benefitType","fieldId","correctedValue"],"properties":{"carrier":{"type":"string","description":"Carrier name","example":"UHC"},"benefitType":{"type":"string","description":"Benefit type","default":"medical","example":"medical"},"fieldId":{"type":"string","description":"Field identifier","example":"deductible_individual"},"value":{"type":"string","description":"Corrected value","example":"$1,500"},"correctedValue":{"type":"string","example":"$1,500"}}},"examples":{"default":{"summary":"Add advisory correction","value":{"carrier":"UHC","benefitType":"medical","fieldId":"deductible_individual","correctedValue":"$1,500"}}}}}},"responses":{"200":{"description":"Advisory correction saved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","result"],"properties":{"ok":{"type":"boolean","example":true},"result":{"type":"object","description":"The saved advisory correction record","properties":{"id":{"type":"string"},"carrier":{"type":"string"},"benefitType":{"type":"string"},"fieldId":{"type":"string"},"value":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}}}},"examples":{"success":{"summary":"Advisory correction saved","value":{"ok":true,"saved":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing required parameters","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"missing_params"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"saveLearnedFix","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/parse/learned\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"carrier\":\"UHC\",\"fieldId\":\"deductible\",\"value\":\"$1500\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/parse/learned', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"carrier\":\"UHC\",\"fieldId\":\"deductible\",\"value\":\"$1500\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/parse/learned',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"carrier\":\"UHC\",\"fieldId\":\"deductible\",\"value\":\"$1500\"}\n)\ndata = response.json()"}]}},"/api/parse/learned/items":{"get":{"summary":"List the authenticated user's advisory correction items","description":"Retrieves the authenticated user's advisory correction items with optional filtering by carrier, benefitType, and fieldId. Items are replay inputs and are never applied to live parses until separately replay-approved.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"carrier","in":"query","schema":{"type":"string"},"description":"Filter by carrier name","example":"UHC"},{"name":"benefitType","in":"query","schema":{"type":"string"},"description":"Filter by benefit type","example":"medical"},{"name":"fieldId","in":"query","schema":{"type":"string"},"description":"Filter by field identifier","example":"deductible"}],"responses":{"200":{"description":"Advisory correction items retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","items"],"properties":{"ok":{"type":"boolean","example":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"carrier":{"type":"string","example":"UHC"},"benefitType":{"type":"string","example":"medical"},"fieldId":{"type":"string","example":"deductible_individual"},"value":{"type":"string","example":"$1,500"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}},"examples":{"success":{"summary":"All advisory corrections","value":{"ok":true,"items":[{"carrier":"UHC","benefitType":"medical","fieldId":"deductible_individual","correctedValue":"$1,500","createdAt":"2025-01-10T14:30:00Z"},{"carrier":"Aetna","benefitType":"medical","fieldId":"coinsurance","correctedValue":"20%","createdAt":"2025-01-08T09:15:00Z"}],"total":2}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Database not configured"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"501":{"description":"Feature not implemented"}},"operationId":"listLearnedFixItems","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/parse/learned/items\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/parse/learned/items', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/parse/learned/items',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/pdf-extractions":{"post":{"summary":"Queue PDF text extraction job","description":"Uploads a PDF file and queues it for text extraction. Returns a job ID that can be polled for status and results. Uses AI credits for trial users.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"PDF file to extract"}},"required":["file"]}}}},"responses":{"202":{"description":"Job queued successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfExtractionAcceptedResponse"},"examples":{"success":{"summary":"Extraction job queued","value":{"success":true,"job":{"id":"pdf_1704067200000_abc123","jobType":"pdf_text_extract","status":"queued","fileName":"benefits_summary.pdf","fileSize":1048576,"mimeType":"application/pdf","createdAt":"2025-01-15T10:00:00Z"},"pollAfterMs":2000}}}}},"headers":{"Location":{"description":"Canonical job status resource.","schema":{"type":"string"}},"Retry-After":{"description":"Recommended seconds before polling.","schema":{"type":"integer","minimum":1}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file or file type","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","enum":["missing_file","invalid_file_type","invalid_file_signature"]},"message":{"type":"string","example":"Only PDF files are supported for text extraction."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Job queue unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"job_queue_unavailable"},"message":{"type":"string","example":"Background processing is not configured on this environment."}}}}}}},"operationId":"createPdfExtraction","x-rateLimit":{"limit":10,"window":"1m","description":"PDF extraction is resource-intensive"},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/pdf-extractions\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@benefits_summary.pdf\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', pdfFile);\n\nconst response = await fetch('https://app.trybart.com/api/pdf-extractions', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst { job, pollAfterMs } = await response.json();\n// Poll /api/pdf-extractions/{job.id} for results"},{"lang":"python","label":"Python","source":"import requests\nimport time\n\nwith open('benefits_summary.pdf', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/pdf-extractions',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f}\n    )\nresult = response.json()\njob_id = result['job']['id']\n# Poll for results\nwhile True:\n    status = requests.get(f'https://app.trybart.com/api/pdf-extractions/{job_id}').json()\n    if status['job']['status'] == 'complete':\n        break\n    time.sleep(2)"}]}},"/api/pdf-extractions/{jobId}":{"get":{"summary":"Get PDF extraction job status","description":"Retrieves the current status and results of a PDF text extraction job.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"},"description":"The job ID returned from the create endpoint","example":"pdf_1704067200000_abc123"}],"responses":{"200":{"description":"Job status retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["success","job"],"properties":{"success":{"type":"boolean","example":true},"job":{"type":"object","properties":{"id":{"type":"string","example":"pdf_1704067200000_abc123"},"jobType":{"type":"string","example":"pdf_text_extract"},"status":{"type":"string","enum":["queued","processing","complete","failed"],"example":"complete"},"error":{"type":"string","nullable":true,"description":"Error message if status is failed"},"fileName":{"type":"string","example":"benefits_summary.pdf"},"fileSize":{"type":"integer","example":1048576},"mimeType":{"type":"string","example":"application/pdf"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"preview":{"type":"string","nullable":true,"description":"First 280 characters of extracted text","example":"BENEFITS SUMMARY..."},"result":{"type":"object","nullable":true,"description":"Extraction results (only present when status is complete)","properties":{"text":{"type":"string","description":"Full extracted text"},"pageCount":{"type":"integer","description":"Number of pages processed","example":5},"metadata":{"type":"object","nullable":true,"description":"PDF metadata"},"sections":{"type":"array","nullable":true,"items":{"type":"object"},"description":"Detected document sections"}}}}}}},"examples":{"queued":{"summary":"Job still queued","value":{"success":true,"job":{"id":"pdf_1704067200000_abc123","jobType":"pdf_text_extract","status":"queued","fileName":"benefits_summary.pdf","fileSize":1048576,"createdAt":"2025-01-15T10:00:00Z"}}},"complete":{"summary":"Extraction complete","value":{"success":true,"job":{"id":"pdf_1704067200000_abc123","jobType":"pdf_text_extract","status":"complete","fileName":"benefits_summary.pdf","fileSize":1048576,"createdAt":"2025-01-15T10:00:00Z","updatedAt":"2025-01-15T10:00:05Z","preview":"BENEFITS SUMMARY\n\nPPO Gold Plan\nDeductible: $1,500 Individual / $3,000 Family...","result":{"text":"BENEFITS SUMMARY\n\nPPO Gold Plan\nDeductible: $1,500 Individual / $3,000 Family\nOut-of-Pocket Maximum: $6,000 / $12,000\nCoinsurance: 20%\n...","pageCount":4,"wordCount":1250,"extractedAt":"2025-01-15T10:00:05Z"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Job not found","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"job_not_found"},"message":{"type":"string","example":"No matching PDF extraction job was found."}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Job queue unavailable"}},"operationId":"getPdfExtractionStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/pdf-extractions/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/pdf-extractions/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/pdf-extractions/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/health":{"get":{"summary":"Plan library health check","description":"Returns health status.","tags":["Plan Library"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy","backend":"s3"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getPlanLibraryHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/batch-save":{"post":{"summary":"Batch save plans to S3","description":"Saves multiple plans to S3.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","items":{"type":"object"}}}},"examples":{"default":{"summary":"Batch save plans","value":{"plans":[{"id":"plan-medical-ppo-gold","name":"PPO Gold 1500","category":"medical","carrier":"UHC","plan":{"planName":"PPO Gold 1500","carrier":"UHC","benefitType":"medical","rateStructure":"composite","enrollmentAndRates":{"employee":{"rate":650},"employeeSpouse":{"rate":1200},"employeeChildren":{"rate":1100},"family":{"rate":1800}}}},{"id":"plan-medical-hdhp","name":"HDHP with HSA","category":"medical","carrier":"UHC","plan":{"planName":"HDHP with HSA","carrier":"UHC","benefitType":"medical","rateStructure":"composite","enrollmentAndRates":{"employee":{"rate":450},"family":{"rate":1200}}}}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"results":{"type":"array"},"summary":{"type":"object"}}},"examples":{"success":{"summary":"Batch save successful","value":{"success":true,"results":[{"itemId":"plan-medical-ppo-gold","success":true,"s3Key":"plans/user123/plan-medical-ppo-gold.json"},{"itemId":"plan-medical-hdhp","success":true,"s3Key":"plans/user123/plan-medical-hdhp.json"}],"summary":{"saved":2,"failed":0}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"batchSavePlansToS3","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-library/s3/batch-save\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[{\"id\":\"plan1\"}]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/batch-save', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[{\"id\":\"plan1\"}]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-library/s3/batch-save',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[{\"id\":\"plan1\"}]}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/delete/{itemId}":{"delete":{"summary":"Delete plan from S3","description":"Deletes a plan library item from S3.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"itemId","in":"path","required":true,"schema":{"type":"string"},"description":"Item unique identifier"},{"name":"visibility","in":"query","schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"itemId":{"type":"string"},"deletedKeys":{"type":"array","items":{"type":"string"}}}},"examples":{"success":{"summary":"Plan deleted","value":{"success":true,"itemId":"plan-medical-ppo-gold","deletedKeys":["plans/user123/plan-medical-ppo-gold.json"]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deletePlanFromS3","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/plan-library/s3/delete/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/delete/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/plan-library/s3/delete/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/documents/{docId}":{"get":{"summary":"Get document info","description":"Returns document info and download URL.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"docId","in":"path","required":true,"schema":{"type":"string"},"description":"Document unique identifier"},{"name":"s3Key","in":"query","schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"visibility","in":"query","schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Organization unique identifier"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"docId":{"type":"string"},"s3Key":{"type":"string"},"downloadUrl":{"type":"string"},"expiresIn":{"type":"integer"}}},"examples":{"success":{"summary":"Document info retrieved","value":{"success":true,"docId":"doc-abc123","s3Key":"documents/user123/benefits-summary.pdf","downloadUrl":"https://example-bucket.s3.amazonaws.com/documents/user123/benefits-summary.pdf?X-Amz-Signature=...","fileName":"benefits-summary.pdf","contentType":"application/pdf","size":2048576,"uploadedAt":"2025-01-10T14:30:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getPlanDocument","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/s3/documents/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/documents/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/s3/documents/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/documents/{docId}/download":{"get":{"summary":"Download document from plan library","description":"Downloads a source document (PDF, image, etc.) associated with a plan library item. Returns the binary file content.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Binary document content. Common types: application/pdf, image/png, image/jpeg","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"headers":{"Content-Type":{"description":"MIME type of the document","schema":{"type":"string","example":"application/pdf"}},"Content-Disposition":{"description":"Original filename","schema":{"type":"string","example":"attachment; filename=\"benefits-summary.pdf\""}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_planlibrary_s3_documents_{docId}_download","parameters":[{"name":"docId","in":"path","required":true,"schema":{"type":"string"},"description":"Document unique identifier"}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/s3/documents/DOC_ID/download\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -o document.pdf"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/documents/DOC_ID/download', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst blob = await response.blob();\nconst url = URL.createObjectURL(blob);"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/s3/documents/DOC_ID/download',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\nwith open('document.pdf', 'wb') as f:\n    f.write(response.content)"}]}},"/api/plan-library/s3/documents/upload":{"post":{"summary":"Upload source documents","description":"Uploads PDF documents to S3. Max 25MB each, up to 10 files.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document file to upload"},"planId":{"type":"string","description":"Associated plan ID"}},"required":["file"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"uploaded":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array"}}},"examples":{"success":{"summary":"Documents uploaded","value":{"success":true,"uploaded":2,"failed":0,"results":[{"docId":"doc-abc123","fileName":"benefits-summary.pdf","s3Key":"documents/user123/benefits-summary.pdf","size":2048576},{"docId":"doc-def456","fileName":"rate-sheet.xlsx","s3Key":"documents/user123/rate-sheet.xlsx","size":524288}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"No files or invalid type"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"uploadPlanDocuments","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-library/s3/documents/upload\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"files=@doc1.pdf\" \\\n  -F \"files=@doc2.pdf\" \\\n  -F \"visibility=private\" \\\n  -F \"planIds=[\"plan-123\"]\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('files', file1);\nformData.append('files', file2);\nformData.append('visibility', 'private');\nformData.append('planIds', JSON.stringify(['plan-123']));\n\nconst response = await fetch('https://app.trybart.com/api/plan-library/s3/documents/upload', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\nimport json\n\nfiles = [\n    ('files', open('doc1.pdf', 'rb')),\n    ('files', open('doc2.pdf', 'rb'))\n]\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-library/s3/documents/upload',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    files=files,\n    data={'visibility': 'private', 'planIds': json.dumps(['plan-123'])}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/load/{itemId}":{"get":{"summary":"Load plan from S3","description":"Loads a plan library item from S3.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"itemId","in":"path","required":true,"schema":{"type":"string"},"description":"Item unique identifier"},{"name":"visibility","in":"query","schema":{"type":"string"},"description":"Query parameter for filtering or options"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Organization unique identifier"},{"name":"s3Key","in":"query","schema":{"type":"string"},"description":"Exact authorized S3 key committed in Plan Library metadata"},{"name":"s3VersionId","in":"query","schema":{"type":"string"},"description":"Immutable S3 VersionId committed with the requested plan revision"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"itemId":{"type":"string"},"planData":{"type":"object"},"s3Key":{"type":"string"},"s3VersionId":{"type":"string","nullable":true}}},"examples":{"success":{"summary":"Plan loaded","value":{"success":true,"itemId":"plan-medical-ppo-gold","planData":{"id":"plan-medical-ppo-gold","name":"PPO Gold 1500","category":"medical","carrier":"UHC","plan":{"planName":"PPO Gold 1500","carrier":"UHC","benefitType":"medical","rateStructure":"composite","enrollmentAndRates":{"employee":{"rate":650},"employeeSpouse":{"rate":1200},"employeeChildren":{"rate":1100},"family":{"rate":1800}},"benefits":{"deductible":{"value":"$1,500 / $3,000"},"oop":{"value":"$6,000 / $12,000"}}},"updatedAt":"2025-01-10T14:30:00Z"},"s3Key":"plan-library/users/user123/plan-medical-ppo-gold.json","s3VersionId":"3LgYQxexampleVersionId"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"loadPlanFromS3","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/s3/load/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/load/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/s3/load/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/save":{"post":{"summary":"Save plan to S3","description":"Saves a plan library item to S3.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["itemId","planData"],"properties":{"itemId":{"type":"string"},"planData":{"type":"object"},"visibility":{"type":"string"},"orgId":{"type":"string"}}},"examples":{"default":{"summary":"Save plan to library","value":{"itemId":"plan-medical-ppo-gold","planData":{"id":"plan-medical-ppo-gold","name":"PPO Gold 1500","category":"medical","carrier":"UHC","plan":{"planName":"PPO Gold 1500","carrier":"UHC","benefitType":"medical","rateStructure":"composite","enrollmentAndRates":{"employee":{"rate":650},"employeeSpouse":{"rate":1200},"employeeChildren":{"rate":1100},"family":{"rate":1800}}}},"visibility":"private"}}}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"itemId":{"type":"string"},"s3Key":{"type":"string"},"versionId":{"type":"string","description":"Immutable S3 VersionId that must be stored with the plan metadata"},"size":{"type":"integer"}}},"examples":{"success":{"summary":"Plan saved","value":{"success":true,"itemId":"plan-medical-ppo-gold","s3Key":"plan-library/users/user123/plan-medical-ppo-gold.json","versionId":"3LgYQxexampleVersionId","size":1024}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"S3 bucket versioning is unavailable"}},"operationId":"savePlanToS3","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/plan-library/s3/save\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"itemId\":\"plan1\",\"planData\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/save', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"itemId\":\"plan1\",\"planData\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/plan-library/s3/save',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"itemId\":\"plan1\",\"planData\":{}}\n)\ndata = response.json()"}]}},"/api/plan-library/s3/status":{"get":{"summary":"Check S3 status","description":"Returns S3 storage availability.","tags":["Plan Library"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean"},"bucket":{"type":"string"},"error":{"type":"string"}}},"examples":{"success":{"value":{"available":true,"bucket":"bart-plan-library"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getPlanLibraryS3Status","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/s3/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/s3/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/s3/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plan-library/status":{"get":{"summary":"Plan library status","description":"Returns backend status.","tags":["Plan Library"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"backend":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"status":"ready","backend":"s3"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getPlanLibraryStatus","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/plans/health":{"get":{"summary":"Plans service health check","description":"Returns health status of the plans service.","tags":["Plans"],"security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","service","status","ts"],"properties":{"ok":{"type":"boolean","example":true},"service":{"type":"string","example":"plans"},"status":{"type":"string","enum":["healthy","not_configured"],"example":"healthy"},"ts":{"type":"string","format":"date-time","description":"Timestamp of health check"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getPlansHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plans/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plans/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plans/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/rate-sheets/import":{"post":{"summary":"Import rate sheet to plan library","description":"Parses a rate sheet file and imports the extracted plans directly to the plan library. Supports selective import of specific plans.","tags":["Parse"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Rate sheet file (Excel/CSV)"}},"required":["file"]}}}},"responses":{"200":{"description":"Rate sheet imported successfully","content":{"application/json":{"schema":{"type":"object","required":["success","imported"],"properties":{"success":{"type":"boolean","example":true},"parseResult":{"type":"object","description":"Original parse results"},"importResult":{"type":"object","description":"Import operation results","properties":{"added":{"type":"integer","example":3},"updated":{"type":"integer","example":1},"skipped":{"type":"integer","example":0}}},"stats":{"type":"object","description":"Updated library statistics","properties":{"totalPlans":{"type":"integer"},"byCarrier":{"type":"object"}}},"imported":{"type":"integer","description":"Number of plans imported","example":4}}},"examples":{"success":{"summary":"Rate sheet imported","value":{"success":true,"parseResult":{"plans":[{"name":"PPO Gold 1500","category":"medical"},{"name":"PPO Silver 2500","category":"medical"},{"name":"HDHP 3500","category":"medical"}],"warnings":[],"errors":[]},"importResult":{"added":3,"updated":0,"skipped":0},"stats":{"totalPlans":45,"byCarrier":{"UHC":15,"Aetna":15,"Cigna":15}},"imported":3}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file, parameters, or parse error"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Import error"}},"operationId":"importRateSheet","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/rate-sheets/import\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@UHC_2025_Rates.xlsx\" \\\n  -F \"carrier=UHC\" \\\n  -F \"effectiveDate=2025-01-01\" \\\n  -F \"replaceExisting=false\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', rateSheetFile);\nformData.append('carrier', 'UHC');\nformData.append('effectiveDate', '2025-01-01');\nformData.append('replaceExisting', 'false');\n\nconst response = await fetch('https://app.trybart.com/api/rate-sheets/import', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('UHC_2025_Rates.xlsx', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/rate-sheets/import',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f},\n        data={\n            'carrier': 'UHC',\n            'effectiveDate': '2025-01-01',\n            'replaceExisting': 'false'\n        }\n    )\ndata = response.json()"}]}},"/api/rate-sheets/parse":{"post":{"summary":"Parse rate sheet file","description":"Parses a rate sheet file (Excel, CSV, or PDF) to extract plan and rate information. Returns parsed data for preview before import. Supports UHC, Aetna, Cigna, and other carriers.","tags":["Parse"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Rate sheet file to parse"}},"required":["file"]}}}},"responses":{"200":{"description":"Rate sheet parsed successfully","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","example":true},"plans":{"type":"array","description":"Parsed plan data","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","example":"PPO Gold 1500"},"category":{"type":"string","example":"medical"},"metadata":{"type":"object"},"plan":{"type":"object","properties":{"planName":{"type":"string"},"carrier":{"type":"string"},"enrollmentAndRates":{"type":"object"}}}}}},"metadata":{"type":"object","properties":{"carrier":{"type":"string"},"effectiveDate":{"type":"string"},"fileName":{"type":"string"}}},"warnings":{"type":"array","items":{"type":"string"}},"errors":{"type":"array","items":{"type":"string"}},"textract":{"type":"object","nullable":true,"description":"Textract processing details if used","properties":{"used":{"type":"boolean"},"tableCount":{"type":"integer"},"rateTableCount":{"type":"integer"},"cost":{"type":"number"},"pageCount":{"type":"integer"},"confidence":{"type":"number"},"durationMs":{"type":"integer"}}},"aiValidation":{"type":"object","nullable":true,"description":"AI validation results if available","properties":{"validated":{"type":"boolean"},"issues":{"type":"array","items":{"type":"string"}}}}}},"examples":{"success":{"summary":"Rate sheet parsed","value":{"success":true,"plans":[{"id":"parsed-plan-1","name":"PPO Gold 1500","category":"medical","metadata":{"effectiveDate":"2025-01-01"},"plan":{"planName":"PPO Gold 1500","carrier":"UHC","enrollmentAndRates":{"employee":{"rate":650},"employeeSpouse":{"rate":1200},"employeeChildren":{"rate":1100},"family":{"rate":1800}}}},{"id":"parsed-plan-2","name":"PPO Silver 2500","category":"medical","plan":{"planName":"PPO Silver 2500","carrier":"UHC","enrollmentAndRates":{"employee":{"rate":550},"employeeSpouse":{"rate":1000},"employeeChildren":{"rate":950},"family":{"rate":1500}}}}],"metadata":{"carrier":"UHC","effectiveDate":"2025-01-01","fileName":"UHC_2025_Rates.xlsx"},"warnings":[],"errors":[],"textract":{"used":false,"tableCount":0}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file or parameters","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","enum":["No file uploaded","validation_error","invalid_file_signature"]},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Parse error"}},"operationId":"parseRateSheet","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/rate-sheets/parse\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@rate_sheet.xlsx\" \\\n  -F \"carrier=Aetna\" \\\n  -F \"useTextract=true\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', rateSheetFile);\nformData.append('carrier', 'Aetna');\nformData.append('useTextract', 'true');\n\nconst response = await fetch('https://app.trybart.com/api/rate-sheets/parse', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst { plans, metadata } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('rate_sheet.xlsx', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/rate-sheets/parse',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f},\n        data={'carrier': 'Aetna', 'useTextract': 'true'}\n    )\nresult = response.json()\nplans = result['plans']"}]}},"/api/rate-sheets/stats":{"get":{"summary":"Get plan library statistics","description":"Retrieves statistics about the plan library including counts by carrier and category, plus Textract usage stats if available.","tags":["Parse"],"security":[],"responses":{"200":{"description":"Statistics retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["success","stats"],"properties":{"success":{"type":"boolean","example":true},"stats":{"type":"object","properties":{"totalPlans":{"type":"integer","example":150},"byCarrier":{"type":"object","additionalProperties":{"type":"integer"},"example":{"UHC":50,"Aetna":45,"Cigna":55}},"byCategory":{"type":"object","additionalProperties":{"type":"integer"},"example":{"medical":100,"dental":30,"vision":20}},"lastImported":{"type":"string","format":"date-time","nullable":true}}},"textract":{"type":"object","nullable":true,"description":"Textract service cost statistics","properties":{"enabled":{"type":"boolean"},"totalCost":{"type":"number"},"monthlyBudget":{"type":"number"},"remainingBudget":{"type":"number"},"pagesProcessed":{"type":"integer"}}}}},"examples":{"success":{"summary":"Library statistics","value":{"success":true,"stats":{"totalPlans":150,"byCarrier":{"UHC":50,"Aetna":45,"Cigna":35,"Blue Cross":20},"byCategory":{"medical":100,"dental":30,"vision":20},"lastImported":"2025-01-15T10:30:00Z"},"textract":{"enabled":true,"totalCost":12.5,"monthlyBudget":100,"remainingBudget":87.5,"pagesProcessed":250}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error"}},"operationId":"getRateSheetStats","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/rate-sheets/stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/rate-sheets/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/rate-sheets/stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/realtime/config":{"get":{"summary":"Get realtime config","description":"Returns realtime configuration.","tags":["Realtime"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"appId":{"type":"string"},"endpoint":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"appId":"bart-prod","endpoint":"wss://realtime.trybart.com"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getRealtimeConfig","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/realtime/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/realtime/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/realtime/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/realtime/health":{"get":{"summary":"Realtime health check","description":"Returns WebSocket, PostgreSQL, and listener health.","tags":["Realtime"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"checks":{"type":"object"},"suggestPolling":{"type":"boolean"},"timestamp":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy","connections":42}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Unhealthy"}},"operationId":"getRealtimeHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/realtime/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/realtime/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/realtime/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/realtime/metrics":{"get":{"summary":"Get realtime metrics","description":"Returns server metrics.","tags":["Realtime"],"security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"metrics":{"type":"object"}}},"examples":{"success":{"value":{"ok":true,"metrics":{"activeConnections":42,"messagesPerSecond":15,"avgLatencyMs":25}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Not initialized"}},"operationId":"getRealtimeMetrics","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/realtime/metrics\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/realtime/metrics', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/realtime/metrics',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/realtime/query":{"post":{"summary":"Execute database query","description":"Executes a one-time database query.","tags":["Realtime"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["query"],"properties":{"query":{"type":"object"}}},"examples":{"default":{"value":{"query":"SELECT * FROM cases WHERE user_id = $1","params":["user123"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"data":{"type":"array"}}},"examples":{"success":{"value":{"ok":true,"rows":[{"id":"case1","employer_name":"Acme"}],"rowCount":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid query"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"realtimeQuery","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/realtime/query\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"query\":\"SELECT...\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/realtime/query', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"query\":\"SELECT...\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/realtime/query',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"query\":\"SELECT...\"}\n)\ndata = response.json()"}]}},"/api/realtime/transact":{"post":{"summary":"Execute database transaction","description":"Executes INSERT, UPDATE, DELETE operations.","tags":["Realtime"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["transactions"],"properties":{"transactions":{"type":"array","items":{"type":"object"}}}},"examples":{"default":{"value":{"operations":[{"type":"insert","table":"cases","data":{"id":"case1"}}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"results":{"type":"array"}}},"examples":{"success":{"value":{"ok":true,"results":[{"success":true,"affectedRows":1}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid format"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"realtimeTransact","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/realtime/transact\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"operations\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/realtime/transact', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"operations\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/realtime/transact',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"operations\":[]}\n)\ndata = response.json()"}]}},"/api/report/health":{"get":{"summary":"Report service health check","description":"Returns health status of the report generation service.","tags":["Reports"],"security":[],"responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","service","status","ts"],"properties":{"ok":{"type":"boolean","example":true},"service":{"type":"string","example":"report-generator"},"status":{"type":"string","enum":["healthy","not_configured"],"example":"healthy"},"ts":{"type":"string","format":"date-time","description":"Timestamp of health check"}}},"examples":{"success":{"value":{"ok":true,"status":"healthy"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"operationId":"getReportHealth","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/report/health\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/report/health', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/report/health',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/activity-log":{"get":{"summary":"Get trial activity log","description":"Returns paginated activity log for trial users.","tags":["Trial Admin"],"operationId":"getTrialActivityLog","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":100},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"}],"responses":{"200":{"description":"Activity log","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"activities":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"value":{"ok":true,"activities":[{"userId":"user123","action":"case_created","timestamp":"2025-01-15T10:00:00Z","metadata":{"caseId":"case1"}}],"total":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/activity-log\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/activity-log', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/activity-log',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/activity-log/stats":{"get":{"summary":"Get activity log statistics","description":"Returns aggregate statistics for trial activity.","tags":["Trial Admin"],"operationId":"getTrialActivityStats","responses":{"200":{"description":"Statistics","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"stats":{"type":"object"}}},"examples":{"success":{"value":{"ok":true,"stats":{"totalActivities":1500,"activeUsers":45,"topActions":{"case_created":500,"export":300}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/activity-log/stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/activity-log/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/activity-log/stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/analytics":{"get":{"summary":"Get trial analytics","description":"Returns trial analytics dashboard data.","tags":["Trial Admin"],"operationId":"getTrialAnalytics","responses":{"200":{"description":"Analytics data","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"analytics":{"type":"object"}}},"examples":{"success":{"value":{"ok":true,"analytics":{"totalTrialUsers":150,"activeToday":25,"conversionRate":0.12,"avgSessionDuration":1800}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/analytics\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/analytics', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/analytics',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/broadcast-email":{"post":{"summary":"Broadcast email to trial users","description":"Sends an email to all trial users.","tags":["Trial Admin"],"operationId":"broadcastTrialEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subject","body"],"properties":{"subject":{"type":"string"},"body":{"type":"string"},"filter":{"type":"object"}}},"examples":{"default":{"value":{"subject":"New Features Available","body":"Check out our latest updates...","targetGroup":"active_trial"}}}}}},"responses":{"200":{"description":"Emails sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"sent":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"sent":45,"failed":0}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/broadcast-email\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"subject\":\"News\",\"body\":\"Content\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/broadcast-email', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"subject\":\"News\",\"body\":\"Content\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/broadcast-email',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"subject\":\"News\",\"body\":\"Content\"}\n)\ndata = response.json()"}]}},"/api/trial/check-case-creation":{"get":{"summary":"Check case creation limit","description":"Checks if user can create more cases.","tags":["Trial Admin"],"operationId":"checkTrialCaseCreation","responses":{"200":{"description":"Case creation status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"canCreate":{"type":"boolean"},"casesUsed":{"type":"integer"},"casesLimit":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"allowed":true,"remaining":3,"limit":5}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/check-case-creation\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/check-case-creation', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/check-case-creation',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/check-plan-limit":{"get":{"summary":"Check plan limit","description":"Checks user plan/feature limits.","tags":["Trial Admin"],"operationId":"checkTrialPlanLimit","responses":{"200":{"description":"Plan limit status","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"withinLimit":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"allowed":true,"currentPlans":8,"limit":20}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/check-plan-limit\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/check-plan-limit', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/check-plan-limit',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/config":{"get":{"summary":"Get trial configuration","description":"Returns current trial system configuration. Admin only.","tags":["Trial Admin"],"operationId":"getTrialConfig","responses":{"200":{"description":"Trial configuration","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"config":{"type":"object","properties":{"maxCasesPerUser":{"type":"integer"},"maxExportsPerDay":{"type":"integer"},"maxAiCredits":{"type":"integer"},"trialDurationDays":{"type":"integer"}}}}},"examples":{"success":{"value":{"ok":true,"config":{"maxCases":5,"maxPlans":20,"maxExports":10,"trialDays":14,"aiCredits":50}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/config', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update trial configuration","description":"Updates trial system configuration. Admin only.","tags":["Trial Admin"],"operationId":"updateTrialConfig","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"maxCasesPerUser":{"type":"integer"},"maxExportsPerDay":{"type":"integer"},"maxAiCredits":{"type":"integer"},"trialDurationDays":{"type":"integer"}}},"examples":{"default":{"value":{"maxCases":10,"maxExports":20}}}}}},"responses":{"200":{"description":"Configuration updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"config":{"type":"object"}}},"examples":{"success":{"value":{"ok":true,"config":{"maxCases":10,"maxExports":20}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/trial/config\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"maxCases\":10}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/config', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"maxCases\":10})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/trial/config',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"maxCases\":10}\n)\ndata = response.json()"}]}},"/api/trial/export-history":{"get":{"summary":"Get export history","description":"Returns export/print history for the authenticated user.","tags":["Trial Admin"],"operationId":"getTrialExportHistory","responses":{"200":{"description":"Export history","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"exports":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"value":{"ok":true,"exports":[{"id":"exp1","format":"pdf","caseId":"case1","createdAt":"2025-01-15T10:00:00Z"}],"total":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/export-history\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/export-history', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/export-history',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/feedback":{"post":{"summary":"Submit trial feedback","description":"Submits user feedback during trial.","tags":["Trial Admin"],"operationId":"submitTrialFeedback","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["feedback"],"properties":{"feedback":{"type":"string"},"rating":{"type":"integer"},"category":{"type":"string"}}},"examples":{"default":{"value":{"rating":4,"feedback":"Great tool!","category":"general"}}}}}},"responses":{"200":{"description":"Feedback submitted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"feedbackId":"fb123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/feedback\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"rating\":5,\"feedback\":\"Great!\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/feedback', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"rating\":5,\"feedback\":\"Great!\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/feedback',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"rating\":5,\"feedback\":\"Great!\"}\n)\ndata = response.json()"}]}},"/api/trial/push-to-s3":{"post":{"summary":"Push config to S3","description":"Pushes trial configuration to S3 for distribution.","tags":["Trial Admin"],"operationId":"pushTrialConfigToS3","responses":{"200":{"description":"Config pushed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"pushed":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/push-to-s3\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/push-to-s3', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/push-to-s3',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"data":{},"options":{}}}}}}},"/api/trial/send-email":{"post":{"summary":"Send email to trial user","description":"Sends an email to a specific trial user.","tags":["Trial Admin"],"operationId":"sendTrialEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to","subject","body"],"properties":{"to":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"}}},"examples":{"default":{"value":{"userId":"user123","template":"trial_reminder","data":{"daysLeft":3}}}}}}},"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"sent":true,"messageId":"msg123"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/send-email\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"userId\":\"user-123\",\"template\":\"welcome\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/send-email', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"userId\":\"user-123\",\"template\":\"welcome\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/send-email',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"userId\":\"user-123\",\"template\":\"welcome\"}\n)\ndata = response.json()"}]}},"/api/trial/track-ai-usage":{"post":{"summary":"Track AI usage","description":"Records AI feature usage for quota tracking.","tags":["Trial Admin"],"operationId":"trackTrialAiUsage","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"feature":{"type":"string"},"tokens":{"type":"integer"}}},"examples":{"default":{"value":{"feature":"ai_parsing","credits":5}}}}}},"responses":{"200":{"description":"Usage tracked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"creditsRemaining":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"creditsRemaining":45}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/track-ai-usage\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"feature\":\"ai_parse\",\"credits\":5}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/track-ai-usage', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"feature\":\"ai_parse\",\"credits\":5})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/track-ai-usage',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"feature\":\"ai_parse\",\"credits\":5}\n)\ndata = response.json()"}]}},"/api/trial/track-export":{"post":{"summary":"Track export action","description":"Records an export action for quota tracking.","tags":["Trial Admin"],"operationId":"trackTrialExport","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"exportType":{"type":"string"},"caseId":{"type":"string"}}},"examples":{"default":{"value":{"format":"pdf","caseId":"case123"}}}}}},"responses":{"200":{"description":"Export tracked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"remaining":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"exportsRemaining":8}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/track-export\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"format\":\"pdf\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/track-export', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"format\":\"pdf\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/track-export',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"format\":\"pdf\"}\n)\ndata = response.json()"}]}},"/api/trial/track-print":{"post":{"summary":"Track print action","description":"Records a print action for quota tracking.","tags":["Trial Admin"],"operationId":"trackTrialPrint","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"caseId":{"type":"string"}}},"examples":{"default":{"value":{"caseId":"case123","pages":5}}}}}},"responses":{"200":{"description":"Print tracked","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"remaining":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"tracked":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/track-print\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/track-print', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/track-print',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/trial/usage-history":{"get":{"summary":"Get usage history","description":"Returns usage history for the authenticated user.","tags":["Trial Admin"],"operationId":"getTrialUsageHistory","responses":{"200":{"description":"Usage history","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"history":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"value":{"ok":true,"history":[{"date":"2025-01-15","cases":2,"exports":3,"aiCredits":10}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/usage-history\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/usage-history', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/usage-history',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/users":{"get":{"summary":"List trial users","description":"Returns paginated list of trial users with case counts. Admin only.","tags":["Trial Admin"],"operationId":"listTrialUsers","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","default":50},"description":"Maximum number of results to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0},"description":"Number of results to skip for pagination"},{"name":"search","in":"query","schema":{"type":"string"},"description":"Search query string"}],"responses":{"200":{"description":"Trial users","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"users":{"type":"array","items":{"type":"object"}},"total":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"users":[{"id":"user123","email":"user@example.com","status":"active","createdAt":"2025-01-10T10:00:00Z"}],"total":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/users\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/users',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/users/{userId}":{"get":{"summary":"Get trial user details","description":"Returns detailed information about a specific trial user.","tags":["Trial Admin"],"operationId":"getTrialUser","parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"User unique identifier"}],"responses":{"200":{"description":"User details","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"user":{"type":"object"}}},"examples":{"success":{"value":{"ok":true,"user":{"id":"user123","email":"user@example.com","status":"active","casesCreated":3,"exportsUsed":5,"aiCreditsUsed":20}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found"}}},"example":{"ok":false,"error":"not_found","message":"Resource not found"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/users/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/users/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/trial/users/{userId}/remove-from-group":{"post":{"summary":"Remove user from trial group","description":"Removes a user from the trial user group.","tags":["Trial Admin"],"operationId":"removeUserFromTrialGroup","parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"User unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"groupId":"group_abc123"}}}},"responses":{"200":{"description":"User removed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"removed":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found"}}},"example":{"ok":false,"error":"not_found","message":"Resource not found"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/EXAMPLE_ID/remove-from-group\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/EXAMPLE_ID/remove-from-group', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/users/EXAMPLE_ID/remove-from-group',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/trial/users/{userId}/upgrade":{"post":{"summary":"Upgrade trial user","description":"Upgrades a trial user to full access.","tags":["Trial Admin"],"operationId":"upgradeTrialUser","parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"},"description":"User unique identifier"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}},"examples":{"default":{"value":{"plan":"professional"}}}}}},"responses":{"200":{"description":"User upgraded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"upgraded":true,"newPlan":"professional"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Resource not found"}}},"example":{"ok":false,"error":"not_found","message":"Resource not found"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/EXAMPLE_ID/upgrade\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plan\":\"pro\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/EXAMPLE_ID/upgrade', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plan\":\"pro\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/users/EXAMPLE_ID/upgrade',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plan\":\"pro\"}\n)\ndata = response.json()"}]}},"/api/trial/users/add-to-group":{"post":{"summary":"Add user to trial group","description":"Adds a user to the trial user group.","tags":["Trial Admin"],"operationId":"addUserToTrialGroup","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"}}},"examples":{"default":{"value":{"userId":"user123","groupId":"beta_testers"}}}}}},"responses":{"200":{"description":"User added","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"added":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/add-to-group\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"userId\":\"user-123\",\"groupId\":\"beta\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/add-to-group', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"userId\":\"user-123\",\"groupId\":\"beta\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/users/add-to-group',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"userId\":\"user-123\",\"groupId\":\"beta\"}\n)\ndata = response.json()"}]}},"/api/trial/users/export-csv":{"get":{"summary":"Export trial users to CSV","description":"Exports all trial users to a CSV file.","tags":["Trial Admin"],"operationId":"exportTrialUsersCsv","responses":{"200":{"description":"CSV file containing trial user data","content":{"text/csv":{"schema":{"type":"string"},"example":"id,email,status,created_at,cases_created,exports_used\nuser_123,user@example.com,active,2025-01-10T10:00:00Z,3,5\nuser_456,another@example.com,trial,2025-01-12T14:30:00Z,1,2"}},"headers":{"Content-Type":{"description":"text/csv","schema":{"type":"string","example":"text/csv"}},"Content-Disposition":{"description":"Suggested filename","schema":{"type":"string","example":"attachment; filename=\"trial_users.csv\""}},"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/trial/users/export-csv\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -o trial_users.csv"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/export-csv', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst csv = await response.text();\n// Parse CSV or download"},{"lang":"python","label":"Python","source":"import requests\nimport csv\nfrom io import StringIO\n\nresponse = requests.get(\n    'https://app.trybart.com/api/trial/users/export-csv',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\nreader = csv.DictReader(StringIO(response.text))\nfor row in reader:\n    print(row)"}]}},"/api/trial/users/import-csv":{"post":{"summary":"Import trial users from CSV","description":"Bulk imports trial users from a CSV file.","tags":["Trial Admin"],"operationId":"importTrialUsersCsv","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"CSV file with user data"}},"required":["file"]}}}},"responses":{"200":{"description":"Users imported","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"imported":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}}}},"examples":{"success":{"value":{"ok":true,"imported":10,"skipped":2,"errors":[]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/import-csv\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -F \"file=@users.csv\""},{"lang":"javascript","label":"JavaScript","source":"const formData = new FormData();\nformData.append('file', csvFile);\n\nconst response = await fetch('https://app.trybart.com/api/trial/users/import-csv', {\n  method: 'POST',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' },\n  body: formData\n});\nconst { imported, skipped } = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nwith open('users.csv', 'rb') as f:\n    response = requests.post(\n        'https://app.trybart.com/api/trial/users/import-csv',\n        headers={'Authorization': 'Bearer YOUR_TOKEN'},\n        files={'file': f}\n    )\nresult = response.json()"}]}},"/api/trial/users/reset-counts":{"post":{"summary":"Reset trial user counts","description":"Resets case/export counts for trial users. Dev only.","tags":["Trial Admin"],"operationId":"resetTrialUserCounts","responses":{"200":{"description":"Counts reset","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"reset":5}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/reset-counts\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/reset-counts', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/users/reset-counts',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"},"example":{"userIds":["user_123","user_456"]}}}}}},"/api/trial/users/upgrade-all":{"post":{"summary":"Upgrade all trial users","description":"Upgrades all trial users to full access.","tags":["Trial Admin"],"operationId":"upgradeAllTrialUsers","responses":{"200":{"description":"Users upgraded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"upgraded":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"upgraded":25}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"},"example":{"targetTier":"professional","notifyUsers":true}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/users/upgrade-all\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plan\":\"pro\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/users/upgrade-all', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plan\":\"pro\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/users/upgrade-all',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plan\":\"pro\"}\n)\ndata = response.json()"}]}},"/api/trial/validate-device":{"post":{"summary":"Validate device","description":"Validates device fingerprint for trial access.","tags":["Trial Admin"],"operationId":"validateTrialDevice","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["deviceId"],"properties":{"deviceId":{"type":"string"}}},"examples":{"default":{"value":{"deviceId":"device_abc123","fingerprint":"fp_xyz"}}}}}},"responses":{"200":{"description":"Device validated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"valid":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"valid":true,"deviceCount":2,"maxDevices":3}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Bad Request - Invalid parameters or malformed request","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_error"},"message":{"type":"string","example":"Invalid request parameters"}}},"example":{"ok":false,"error":"validation_error","message":"Invalid request parameters"}}}},"401":{"description":"Unauthorized - Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"},"message":{"type":"string","example":"Authentication required"}}},"example":{"ok":false,"error":"unauthorized","message":"Authentication required"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"internal_error"},"message":{"type":"string","example":"An unexpected error occurred"}}},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"security":[{"bearerAuth":[]}],"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/trial/validate-device\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"deviceId\":\"device-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/trial/validate-device', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"deviceId\":\"device-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/trial/validate-device',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"deviceId\":\"device-123\"}\n)\ndata = response.json()"}]}},"/api/usage/export":{"post":{"summary":"Track export usage event","description":"Records an export event for usage tracking and quota enforcement. Increments export count for trial users and logs to user_exports table.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["exportType"],"properties":{"exportType":{"type":"string","description":"Type of export","example":"pdf"},"caseId":{"type":"string","description":"Associated case ID","example":"case-acme-2025"},"format":{"type":"string","description":"Export format","example":"pdf"},"sizeBytes":{"type":"integer","description":"Export file size","example":1048576},"requestId":{"type":"string","description":"Unique request identifier"},"quantity":{"type":"integer","default":1}}},"examples":{"default":{"value":{"eventType":"pdf_export","caseId":"case123","metadata":{"format":"pdf","pages":5}}}}}}},"responses":{"200":{"description":"Export tracked successfully","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true},"tracked":{"type":"boolean","description":"Whether logged to user_exports","example":true},"usageLogged":{"type":"boolean","description":"Whether logged to usage_events","example":true},"quotaEnforced":{"type":"boolean","description":"Whether quota was checked/incremented","example":true},"deduplicated":{"type":"boolean","description":"True if request was deduplicated within 1s window"},"exportCount":{"type":"integer","description":"Current export count (trial users only)","example":5},"exportLimit":{"type":"integer","description":"Export limit (trial users only)","example":10},"remaining":{"type":"integer","description":"Remaining exports (trial users only)","example":5}}},"examples":{"success":{"value":{"ok":true,"tracked":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing export type","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"export_type_required"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Export limit reached (trial users)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"export_limit_reached"},"message":{"type":"string","example":"You have reached your trial export limit"},"exportCount":{"type":"integer","example":10},"exportLimit":{"type":"integer","example":10},"allowed":{"type":"boolean","example":false},"remaining":{"type":"integer","example":0}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"trackExportUsage","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/usage/export\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"eventType\":\"pdf_export\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/usage/export', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"eventType\":\"pdf_export\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/usage/export',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"eventType\":\"pdf_export\"}\n)\ndata = response.json()"}]}},"/api/usage/feature":{"post":{"summary":"Track feature usage event","description":"Records feature usage for analytics. Stores to feature_usage table with action and optional metadata.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["featureName"],"properties":{"featureName":{"type":"string","description":"Name of the feature used","example":"ai-assist"},"action":{"type":"string","description":"Action performed","default":"used","example":"enabled"},"metadata":{"type":"object","description":"Additional context","example":{"duration":5000}},"orgId":{"type":"string","description":"Organization ID"},"sessionId":{"type":"string","description":"Session identifier"}}},"examples":{"default":{"value":{"feature":"contribution_modeler","action":"opened","metadata":{"caseId":"case123"}}}}}}},"responses":{"200":{"description":"Feature usage tracked successfully","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}},"examples":{"success":{"value":{"ok":true,"tracked":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Missing feature name","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"feature_required"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Failed to track feature usage","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"feature_usage_failed"}}}}}}},"operationId":"trackFeatureUsage","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/usage/feature\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"feature\":\"modeler\",\"action\":\"opened\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/usage/feature', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"feature\":\"modeler\",\"action\":\"opened\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/usage/feature',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"feature\":\"modeler\",\"action\":\"opened\"}\n)\ndata = response.json()"}]}},"/api/user/preferences":{"delete":{"summary":"Clear all user preferences","description":"Deletes all preferences for the authenticated user.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Cleared","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"integer"}}},"examples":{"success":{"value":{"ok":true,"message":"All preferences cleared"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"clearUserPreferences","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/user/preferences\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/user/preferences',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"List all user preferences","description":"Returns all stored preferences for the authenticated user.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"preferences":{"type":"array","items":{"type":"object"}}}},"examples":{"success":{"value":{"ok":true,"preferences":{"theme":"dark","defaultBenefitType":"medical","autoSave":true}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listUserPreferences","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/user/preferences\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/user/preferences',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/user/preferences/{key}":{"delete":{"summary":"Delete a user preference","description":"Deletes a single preference by key.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Path parameter: key"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"key":{"type":"string"},"deleted":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"message":"Preference deleted"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Not found"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"deleteUserPreference","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X DELETE \"https://app.trybart.com/api/user/preferences/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences/EXAMPLE_ID', {\n  method: 'DELETE',\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.delete(\n    'https://app.trybart.com/api/user/preferences/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"get":{"summary":"Get a user preference","description":"Returns a single preference by key.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Path parameter: key"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"key":{"type":"string"},"value":{},"exists":{"type":"boolean"}}},"examples":{"success":{"value":{"ok":true,"key":"theme","value":"dark"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"getUserPreference","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/user/preferences/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences/EXAMPLE_ID', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/user/preferences/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Set a user preference","description":"Creates or updates a single preference. Max 10KB.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"},"description":"Path parameter: key"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["value"],"properties":{"value":{}}},"examples":{"default":{"value":{"value":"light"}}}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"key":{"type":"string"},"updatedAt":{"type":"string"}}},"examples":{"success":{"value":{"ok":true,"key":"theme","value":"light"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"description":"Value too large"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"setUserPreference","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/user/preferences/EXAMPLE_ID\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"value\":\"dark\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences/EXAMPLE_ID', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"value\":\"dark\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/user/preferences/EXAMPLE_ID',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"value\":\"dark\"}\n)\ndata = response.json()"}]}},"/api/user/preferences/batch":{"post":{"summary":"Batch set preferences","description":"Sets multiple preferences at once.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object"}}}},"examples":{"default":{"value":{"preferences":{"theme":"dark","autoSave":true}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"saved":{"type":"integer"},"errors":{"type":"array"}}},"examples":{"success":{"value":{"ok":true,"updated":2}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"batchSetUserPreferences","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/user/preferences/batch\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"preferences\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences/batch', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"preferences\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/user/preferences/batch',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"preferences\":{}}\n)\ndata = response.json()"}]}},"/api/user/preferences/keys":{"get":{"summary":"List preference keys","description":"Returns only preference keys without values.","tags":["User Preferences"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"keys":{"type":"array","items":{"type":"string"}}}},"examples":{"success":{"value":{"ok":true,"keys":["theme","defaultBenefitType","autoSave","sidebarCollapsed"]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"listUserPreferenceKeys","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/user/preferences/keys\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/user/preferences/keys', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/user/preferences/keys',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/bulk":{"post":{"summary":"Bulk parse documents with AI","deprecated":true,"description":"Parses multiple text documents sequentially and returns per-document results.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseBulkResponse"},"examples":{"success":{"value":{"ok":true,"results":[{"index":0,"fileName":"doc-1.pdf","ok":true,"source":"ai_text","confidence":"high","cost":0.0012,"durationMs":980,"benefits":{"deductible":{"value":"$1,000","confidence":"high"}}}],"summary":{"total":2,"success":1,"failed":1,"totalCost":0.0012,"durationMs":2100},"requestId":"ai-parse-1736990000000-bulk1"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"207":{"description":"All documents failed to parse"},"400":{"description":"Invalid input or batch size exceeded"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"}},"operationId":"post_api_v1_aiparse_bulk","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseBulkRequest"},"examples":{"default":{"value":{"forceAI":false,"documents":[{"fileName":"doc-1.pdf","text":"Text content for document 1..."},{"fileName":"doc-2.pdf","text":"Text content for document 2..."}]}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/bulk\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"documentIds\":[\"doc1\",\"doc2\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/bulk', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"documentIds\":[\"doc1\",\"doc2\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/bulk',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"documentIds\":[\"doc1\",\"doc2\"]}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/compare":{"post":{"summary":"Compare basic vs AI parsing","deprecated":true,"description":"Runs regex-based parsing and AI parsing on the same PDF for comparison.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseCompareResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"comparison":{"differences":[{"field":"deductible","doc1":"$1,500","doc2":"$2,000"}]}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"PDF file required"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"}},"operationId":"post_api_v1_aiparse_compare","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file1":{"type":"string","format":"binary","description":"First document to compare"},"file2":{"type":"string","format":"binary","description":"Second document to compare"}},"required":["file1","file2"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/compare\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"docId\":\"doc-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/compare', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"docId\":\"doc-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/compare',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"docId\":\"doc-123\"}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/document":{"post":{"summary":"Parse a document with AI","description":"Parses a PDF or image using AI-first extraction. Supports optional raw text return.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseDocumentResponse"},"examples":{"success":{"value":{"ok":true,"carrier":"Aetna","planName":"PPO Gold","planType":"medical","confidence":"high","source":"ai_text","cost":0.0024,"durationMs":1840,"requestId":"ai-parse-1736990000000-abcde","benefits":{"deductible":{"value":"$1,500 / $3,000","confidence":"high"},"oop":{"value":"$3,000 / $6,000","confidence":"medium"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid input or missing file"},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"description":"No parseable content or PDF extraction failed"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"},"503":{"description":"Service unavailable"}},"operationId":"post_api_v1_aiparse_document","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document to parse with AI"},"documentTypeHint":{"type":"string","description":"Optional document-type hint to bias parser selection","enum":["sbc","quote","rates","invoice","renewal","level-funded","self-funded","self-insured","peo","not-specified"]},"benefitTypeHint":{"type":"string","description":"Optional benefit-type hint for extraction","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]}},"required":["file"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/document\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"docId\":\"doc-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/document', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"docId\":\"doc-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/document',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"docId\":\"doc-123\"}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/document/stream":{"post":{"summary":"Parse a document with AI (NDJSON streaming)","description":"Streaming variant of POST /document. Returns application/x-ndjson — one JSON event per line — so clients can render plans progressively as the model emits them instead of waiting ~60s for the full response. Event types: started, plan, first_pass_complete, followup_start, followup_complete, done, error. Supports text-bearing PDFs for quote/ancillary and invoice extraction (auto-detected, honors documentTypeHint). Image / SBC / self-funded docs should use POST /document.","tags":["AI"],"security":[{"bearerAuth":[]}],"operationId":"post_api_v1_aiparse_document_stream","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document to parse (PDF or XLSX)"},"documentTypeHint":{"type":"string","description":"Optional document-type hint (e.g., 'invoice', 'quote') to bias parser selection","enum":["sbc","quote","rates","invoice","renewal","level-funded","self-funded","self-insured","peo","not-specified"]}},"required":["file"]}}}},"responses":{"200":{"description":"Streaming NDJSON response. One JSON event per newline-delimited line.","content":{"application/x-ndjson":{"schema":{"type":"string","description":"Newline-delimited JSON events of types: started, plan, first_pass_complete, followup_start, followup_complete, done, error"},"examples":{"stream":{"summary":"Sample event stream (truncated)","value":"{\"type\":\"started\",\"requestId\":\"ai-parse-1736990000000-abcde\"}\n{\"type\":\"plan\",\"plan\":{\"planName\":\"PPO 1500\"},\"pass\":1}\n{\"type\":\"first_pass_complete\",\"planCount\":3}\n{\"type\":\"done\",\"plans\":[],\"totalCost\":0.42,\"durationMs\":58000}\n"}}}}},"400":{"description":"No file uploaded"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal error"}}}},"/api/v1/ai-parse/gap-fill":{"post":{"summary":"AI gap-fill for missing benefit fields","description":"Targeted re-extraction of benefit fields missing after the first parse pass. Much faster than a full re-scan (~3–8s vs ~20–40s). Accepts already-extracted document text and a partial benefits map; returns only the newly-filled fields plus a list of fields still missing.","tags":["AI"],"security":[{"bearerAuth":[]}],"operationId":"post_api_v1_aiparse_gap_fill","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":100,"description":"Already-extracted document text (required, ≥100 chars)"},"existingBenefits":{"type":"object","description":"Benefits already extracted from first pass, keyed by fieldId","additionalProperties":true},"documentType":{"type":"string","enum":["medical","dental","vision","life","std","ltd"],"default":"medical"},"planName":{"type":"string","description":"Optional plan name for logging"}},"required":["text"]}}}},"responses":{"200":{"description":"Gap-fill complete","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"benefits":{"type":"object","description":"Newly-extracted benefits keyed by fieldId. Each value is { value, confidence }.","additionalProperties":true},"filledFields":{"type":"integer","description":"Count of fields newly filled by this gap-fill call"},"missingFields":{"type":"array","items":{"type":"string"},"description":"Field IDs still missing after gap-fill"},"cost":{"type":"number","description":"Estimated AI cost in USD"},"durationMs":{"type":"integer"}}},"examples":{"success":{"summary":"Successful gap-fill","value":{"ok":true,"filledFields":4,"missingFields":["dental-orthodontia"],"cost":0.0023,"durationMs":4800}}}}}},"400":{"description":"Validation error (missing_text or insufficient_text)","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","enum":["missing_text","insufficient_text"]},"message":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal error"}}}},"/api/v1/ai-parse/stats":{"get":{"summary":"Get AI parse stats","description":"Returns usage and cost statistics for AI parsing. Admin only.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseStatsResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"stats":{"totalParsed":1500,"avgConfidence":0.92}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Forbidden"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_v1_aiparse_stats","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/v1/ai-parse/stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/v1/ai-parse/stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/text":{"post":{"summary":"Parse raw text with AI","deprecated":true,"description":"Parses extracted text using AI. Useful when text is already available client-side.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseDocumentResponse"},"examples":{"success":{"value":{"ok":true,"carrier":"Blue Shield","planName":"HMO Silver","planType":"medical","confidence":"medium","source":"ai_text","cost":0.0018,"durationMs":1120,"requestId":"ai-parse-1736990000000-xyz12","benefits":{"deductible":{"value":"$2,000","confidence":"medium"},"coinsurance":{"value":"20%","confidence":"high"}}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid input or text too short"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"}},"operationId":"post_api_v1_aiparse_text","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseTextRequest"},"examples":{"default":{"value":{"text":"Sample SBC text content...","forceAI":false}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/text\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"benefits text...\",\"carrier\":\"UHC\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/text', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"text\":\"benefits text...\",\"carrier\":\"UHC\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/text',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"text\":\"benefits text...\",\"carrier\":\"UHC\"}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/textract/forms":{"post":{"summary":"Extract forms with Textract","description":"Extracts key-value pairs from PDF files using AWS Textract.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseTextractFormsResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"forms":[{"key":"Deductible","value":"$1,500"}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"},"503":{"description":"Textract unavailable"}},"operationId":"post_api_v1_aiparse_textract_forms","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document for form extraction"}},"required":["file"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/textract/forms\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"docId\":\"doc-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/textract/forms', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"docId\":\"doc-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/textract/forms',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"docId\":\"doc-123\"}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/textract/queries":{"post":{"summary":"Extract queries with Textract","description":"Uses Textract Queries to extract targeted fields from a PDF.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseTextractQueriesResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"answers":[{"query":"What is the deductible?","answer":"$1,500","confidence":0.95}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file or queries"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"},"503":{"description":"Textract unavailable"}},"operationId":"post_api_v1_aiparse_textract_queries","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document for query extraction"},"queries":{"type":"array","items":{"type":"string"},"description":"Extraction queries"}},"required":["file"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/textract/queries\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"docId\":\"doc-123\",\"queries\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/textract/queries', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"docId\":\"doc-123\",\"queries\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/textract/queries',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"docId\":\"doc-123\",\"queries\":[]}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/textract/status":{"get":{"summary":"Get Textract status","description":"Returns Textract availability, configuration, and cost statistics.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseTextractStatusResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"available":true,"region":"us-east-1"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_v1_aiparse_textract_status","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/v1/ai-parse/textract/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/textract/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/v1/ai-parse/textract/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/v1/ai-parse/textract/tables":{"post":{"summary":"Extract tables with Textract","description":"Extracts tables from PDF files using AWS Textract.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiParseTextractTablesResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"tables":[{"headers":["Coverage","Amount"],"rows":[["Deductible","$1,500"]]}]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid file"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Internal error"},"503":{"description":"Textract unavailable"}},"operationId":"post_api_v1_aiparse_textract_tables","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"Document for table extraction"}},"required":["file"]}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/ai-parse/textract/tables\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"docId\":\"doc-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/ai-parse/textract/tables', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"docId\":\"doc-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/ai-parse/textract/tables',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"docId\":\"doc-123\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/analyze-document":{"post":{"summary":"Analyze document using Bedrock AI","description":"Analyze a document using Amazon Bedrock AI. Supports summary, validation, extraction, or custom analysis.","tags":["AI"],"security":[{"bearerAuth":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"analysis":{"type":"string"},"analysisType":{"type":"string","enum":["summary","validation","extraction","custom"]},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"analysis":"This is a PPO plan with...","analysisType":"summary","usage":{"input_tokens":2500,"output_tokens":500}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"202":{"description":"Bedrock analysis job queued.","headers":{"Location":{"description":"Canonical job status resource.","schema":{"type":"string"}},"Retry-After":{"description":"Recommended seconds before polling.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncJobSubmission"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_analyzedocument","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["documentText"],"properties":{"documentText":{"type":"string","minLength":1,"maxLength":500000},"analysisType":{"type":"string","enum":["summary","validation","extraction","custom"],"default":"summary"},"customPrompt":{"type":"string","maxLength":5000},"model":{"type":"string","maxLength":200},"maxTokens":{"type":"integer","minimum":1,"maximum":100000}}},"examples":{"default":{"summary":"Example request","value":{"documentText":"This Summary of Benefits...","analysisType":"summary"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/analyze-document\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"documentId\":\"doc-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/analyze-document', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"documentId\":\"doc-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/analyze-document',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"documentId\":\"doc-123\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/chat":{"post":{"summary":"Send chat message to Bedrock AI","description":"Send a chat message to Amazon Bedrock AI. Supports streaming responses, custom models, and conversation context.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"AI chat response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"content":{"type":"string","description":"AI response"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}},"model":{"type":"string"},"stopReason":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"content":"The deductible is...","usage":{"input_tokens":50,"output_tokens":120},"model":"us.anthropic.claude-haiku-4-5-20251001-v1:0"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_chat","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","description":"Chat messages (1-50)","minItems":1,"maxItems":50,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant","system"]},"content":{"type":"string","maxLength":100000}}}},"model":{"type":"string","description":"Bedrock model ID","maxLength":200},"maxTokens":{"type":"integer","description":"Max tokens (1-200000)","minimum":1,"maximum":200000},"temperature":{"type":"number","description":"Sampling temperature (0-1)","minimum":0,"maximum":1},"stream":{"type":"boolean","description":"Enable streaming","default":false},"system":{"type":"string","description":"System prompt","maxLength":10000},"stopSequences":{"type":"array","maxItems":10,"items":{"type":"string"}}}},"examples":{"default":{"summary":"Example request","value":{"messages":[{"role":"user","content":"Explain the deductible"}],"maxTokens":1000}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/chat\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"message\":\"Explain this plan\",\"context\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/chat', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"message\":\"Explain this plan\",\"context\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/chat',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"message\":\"Explain this plan\",\"context\":{}}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/compare-plans":{"post":{"summary":"Compare plans using AI","description":"Compare multiple benefit plans using Amazon Bedrock AI analysis.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"comparison":{"type":"string"},"planCount":{"type":"integer"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"comparison":"Plan 1 offers better coverage...","planCount":2,"usage":{"input_tokens":1500,"output_tokens":600}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_compareplans","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","minItems":2,"maxItems":10,"items":{"type":"object","additionalProperties":true}},"model":{"type":"string","maxLength":200},"maxTokens":{"type":"integer","minimum":512,"maximum":8192}}},"examples":{"default":{"summary":"Example request","value":{"plans":[{"id":"plan-1","planName":"PPO Gold"},{"id":"plan-2","planName":"HDHP Bronze"}]}}}}}},"x-rateLimit":{"limit":10,"window":"1m","description":"Plan comparison uses AI resources"},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/compare-plans\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planIds\":[\"plan1\",\"plan2\"]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/compare-plans', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planIds\":[\"plan1\",\"plan2\"]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/compare-plans',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planIds\":[\"plan1\",\"plan2\"]}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/cost-stats":{"get":{"summary":"Get Bedrock cost statistics","description":"Get cost tracking statistics for Bedrock API usage (admin only).","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"stats":{"type":"object","additionalProperties":true},"budgets":{"type":"object","properties":{"hourly":{"type":"string"},"daily":{"type":"string"}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"stats":{"totalCalls":5000,"totalCost":45.5},"budgets":{"hourly":"10.0","daily":"100.0"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_v1_bedrock_coststats","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/v1/bedrock/cost-stats\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/cost-stats', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/v1/bedrock/cost-stats',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/ecd-contribution-analysis":{"post":{"summary":"AI contribution strategy analysis","description":"AI-powered contribution strategy recommendation for Employee Cost Difference analysis.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"analysis":{"type":"object","additionalProperties":true},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}},"estimatedCost":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"analysis":{"recommendation":{"strategy":"neutralize","reasoning":"Keep employee costs flat"},"suggestedContributions":[{"tier":"employee only","erPercent":85}]},"estimatedCost":"$0.000125"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_ecdcontributionanalysis","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tierStats"],"properties":{"tierStats":{"type":"array","minItems":1,"maxItems":6,"items":{"type":"object","required":["tier","count"],"properties":{"tier":{"type":"string"},"count":{"type":"integer"},"avgCurrentPremium":{"type":"number"},"avgProposedPremium":{"type":"number"},"currentErPercent":{"type":"number"}}}},"budget":{"type":"number","minimum":0},"companySize":{"type":"string","enum":["small","medium","large"]},"ratingType":{"type":"string","enum":["composite","age-rated","unknown"]},"goal":{"type":"string","enum":["minimize-impact","hold-ee-cost","budget-constrained","balanced"]},"maxTokens":{"type":"integer","minimum":128,"maximum":512}}},"examples":{"default":{"summary":"Example request","value":{"tierStats":[{"tier":"employee only","count":50,"avgCurrentPremium":650,"avgProposedPremium":700,"currentErPercent":80}],"goal":"balanced"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/ecd-contribution-analysis\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/ecd-contribution-analysis', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/ecd-contribution-analysis',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/ecd-per-plan-analysis":{"post":{"summary":"Per-plan contribution analysis","description":"AI-powered contribution recommendations for multiple plans in matrix view.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"recommendations":{"type":"array","items":{"type":"object"}},"planCount":{"type":"integer"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}},"estimatedCost":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"recommendations":[{"planId":"plan-1","strategy":"neutralize","contributions":[]}],"planCount":1,"estimatedCost":"$0.0002"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_ecdperplananalysis","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","minItems":1,"maxItems":10,"items":{"type":"object","required":["planId","planName","tierStats"],"properties":{"planId":{"type":"string"},"planName":{"type":"string"},"tierStats":{"type":"array","items":{"type":"object"}}}}},"budget":{"type":"number","minimum":0},"companySize":{"type":"string","enum":["small","medium","large"]},"ratingType":{"type":"string","enum":["composite","age-rated","unknown"]},"maxTokens":{"type":"integer","minimum":256,"maximum":2048}}},"examples":{"default":{"summary":"Example request","value":{"plans":[{"planId":"plan-1","planName":"PPO Gold","tierStats":[{"tier":"employee only","count":50}]}]}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/ecd-per-plan-analysis\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planId\":\"plan-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/ecd-per-plan-analysis', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planId\":\"plan-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/ecd-per-plan-analysis',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planId\":\"plan-123\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/estimate-cost":{"post":{"summary":"Estimate Bedrock API cost","description":"Estimate the cost of a Bedrock API call based on token counts.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"inputCost":{"type":"number"},"outputCost":{"type":"number"},"totalCost":{"type":"number"},"model":{"type":"string"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"inputCost":0.00025,"outputCost":0.000625,"totalCost":0.000875,"model":"us.anthropic.claude-haiku-4-5-20251001-v1:0"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_estimatecost","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["inputTokens","outputTokens"],"properties":{"inputTokens":{"type":"integer","minimum":0},"outputTokens":{"type":"integer","minimum":0},"model":{"type":"string"}}},"examples":{"default":{"summary":"Example request","value":{"inputTokens":1000,"outputTokens":500,"model":"us.anthropic.claude-haiku-4-5-20251001-v1:0"}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/estimate-cost\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/estimate-cost', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/estimate-cost',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[]}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/executive-summary":{"post":{"summary":"Generate executive summary","description":"Generate an AI-powered executive summary for a benefits case.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"summary":{"type":"string"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"summary":"Acme Corporation benefits overview...","usage":{"input_tokens":3000,"output_tokens":800}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_executivesummary","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["caseData"],"properties":{"caseData":{"type":"object","description":"Case data with plans and enrollment","additionalProperties":true},"model":{"type":"string","maxLength":200},"maxTokens":{"type":"integer","minimum":256,"maximum":4096}}},"examples":{"default":{"summary":"Example request","value":{"caseData":{"employerName":"Acme Corp","planData":{}},"maxTokens":2048}}}}}},"x-rateLimit":{"limit":5,"window":"1m","description":"Executive summary generation is resource-intensive"},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/executive-summary\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"caseId\":\"case-123\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/executive-summary', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"caseId\":\"case-123\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/executive-summary',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"caseId\":\"case-123\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/extract-benefit-ids":{"post":{"summary":"Extract benefit values from document","description":"Extract canonical benefit values (deductible, OOP, copays, etc.) from document text or spreadsheet data.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"benefits":{"type":"object","description":"Extracted benefit values","additionalProperties":true},"identifiers":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object"},"stats":{"type":"object"},"extractionMethod":{"type":"string","enum":["ai","regex-only","unknown"]}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"benefits":{"deductible":"$1,500 / $3,000","oop":"$6,000 / $12,000"},"identifiers":[],"extractionMethod":"ai"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_extractbenefitids","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"Document text to extract from"},"rows":{"type":"array","description":"Spreadsheet rows","items":{"type":"object"}},"pdfBase64":{"type":"string","description":"Base64-encoded PDF"},"documentType":{"type":"string","description":"Document type (SBC, schedule)"},"useAI":{"type":"boolean"},"useRegex":{"type":"boolean","default":true}}},"examples":{"default":{"summary":"Example request","value":{"text":"Deductible: $1,500 individual / $3,000 family...","useAI":true}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/extract-benefit-ids\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"text\":\"plan benefits...\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/extract-benefit-ids', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"text\":\"plan benefits...\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/extract-benefit-ids',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"text\":\"plan benefits...\"}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/status":{"get":{"summary":"Get Bedrock service status","description":"Check if Bedrock AI service is available and get configuration.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"available":{"type":"boolean"},"enabled":{"type":"boolean"},"initialized":{"type":"boolean"},"region":{"type":"string"},"defaultModel":{"type":"string"},"costStats":{"type":"object","description":"Cost stats (admin only)"}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"available":true,"enabled":true,"initialized":true,"region":"us-east-1","defaultModel":"us.anthropic.claude-haiku-4-5-20251001-v1:0"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"get_api_v1_bedrock_status","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/v1/bedrock/status\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/status', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/v1/bedrock/status',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/v1/bedrock/validate-rate-sheet":{"post":{"summary":"Validate rate sheet using AI","description":"Validate rate sheet data for anomalies using Amazon Bedrock AI.","tags":["AI"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"validation":{"type":"object","additionalProperties":true},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer"},"output_tokens":{"type":"integer"}}}}},"examples":{"success":{"summary":"Successful response","value":{"ok":true,"validation":{"valid":true,"warnings":[]},"usage":{"input_tokens":500,"output_tokens":200}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"503":{"description":"Bedrock service unavailable"}},"operationId":"post_api_v1_bedrock_validateratesheet","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["rateSheetData"],"properties":{"rateSheetData":{"type":"object","description":"Rate sheet data to validate","additionalProperties":true},"model":{"type":"string","maxLength":200},"maxTokens":{"type":"integer","minimum":512,"maximum":8192}}},"examples":{"default":{"summary":"Example request","value":{"rateSheetData":{"tiers":["Employee","Family"],"rates":[[650],[1800]]}}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/v1/bedrock/validate-rate-sheet\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"data\":{}}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/v1/bedrock/validate-rate-sheet', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"data\":{}})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/v1/bedrock/validate-rate-sheet',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"data\":{}}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/analytics":{"get":{"summary":"Get view analytics for a report","description":"Retrieves aggregated analytics data for a shared web report including total views, unique visitors, and device breakdown. Only the report owner can access analytics.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"The unique report identifier","example":"GQHqYBdunPQKXdBKVrRBbA"}],"responses":{"200":{"description":"Analytics data retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","reportId","analytics"],"properties":{"ok":{"type":"boolean","example":true},"reportId":{"type":"string","example":"GQHqYBdunPQKXdBKVrRBbA"},"analytics":{"type":"object","properties":{"totalViews":{"type":"integer","description":"Total number of views","example":125},"uniqueVisitors":{"type":"integer","description":"Number of unique visitors","example":45},"deviceBreakdown":{"type":"object","properties":{"mobile":{"type":"integer","example":30},"desktop":{"type":"integer","example":85},"tablet":{"type":"integer","example":10}}},"firstView":{"type":"string","format":"date-time","nullable":true},"lastView":{"type":"string","format":"date-time","nullable":true}}}}},"examples":{"success":{"summary":"Analytics retrieved","value":{"ok":true,"reportId":"GQHqYBdunPQKXdBKVrRBbA","analytics":{"totalViews":125,"uniqueVisitors":45,"deviceBreakdown":{"mobile":30,"desktop":85,"tablet":10},"firstView":"2025-01-10T14:30:00Z","lastView":"2025-01-15T09:15:00Z"}}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found or user lacks permission","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Report not found"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"fetch_failed"},"message":{"type":"string","example":"Failed to fetch analytics"}}}}}}},"operationId":"getWebReportAnalytics","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/analytics\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/analytics', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/analytics',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/live":{"patch":{"summary":"Toggle live mode for a report","description":"Enable or disable live mode for a shared web report. When live mode is enabled, the report will automatically update when the underlying case data changes. Only the report owner can toggle this setting.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"The unique report identifier","example":"GQHqYBdunPQKXdBKVrRBbA"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["isLive"],"properties":{"isLive":{"type":"boolean","description":"Whether to enable (true) or disable (false) live mode","example":true}}},"examples":{"enableLive":{"summary":"Enable live mode","value":{"isLive":true}},"disableLive":{"summary":"Disable live mode","value":{"isLive":false}}}}}},"responses":{"200":{"description":"Live mode toggled successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","isLive","message"],"properties":{"ok":{"type":"boolean","example":true},"isLive":{"type":"boolean","description":"Current live mode state after toggle","example":true},"message":{"type":"string","description":"Status message","example":"Live mode enabled"}}},"examples":{"success":{"summary":"Live mode toggled","value":{"ok":true,"isLive":true,"message":"Live mode enabled"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request - isLive must be a boolean","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"invalid_request"},"message":{"type":"string","example":"isLive must be a boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found or user lacks permission","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Report not found or you do not have permission to update it"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"toggle_failed"},"message":{"type":"string","example":"Failed to toggle live mode"}}}}}}},"operationId":"toggleWebReportLiveMode","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PATCH \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/live\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"isLive\":true}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/live', {\n  method: 'PATCH',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"isLive\":true})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.patch(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/live',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"isLive\":true}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/refresh":{"put":{"summary":"Refresh live report content","description":"Updates the content of a live shared report when the underlying case data changes.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"Report unique identifier"},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v2\""}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["capturedHtml"],"properties":{"capturedHtml":{"type":"string","description":"The new captured HTML content"},"capturedHtmlByType":{"type":"object","additionalProperties":{"type":"string"},"description":"HTML content by benefit type for multi-tab reports"},"reportData":{"type":"object"},"options":{"type":"object"}}},"examples":{"default":{"summary":"Refresh report content","value":{"capturedHtml":"<div class=\"report-content\">Updated benefits comparison table...</div>","capturedHtmlByType":{"medical":"<div>Medical plans...</div>","dental":"<div>Dental plans...</div>"},"reportData":{"employerName":"Acme Corp","reportTypes":["medical","dental"]}}},"request":{"summary":"Refresh report with new data","value":{"caseId":"case_abc123"}}}}}},"responses":{"200":{"description":"Report refreshed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":true},"message":{"type":"string","example":"Report content updated"},"updatedAt":{"type":"string","format":"date-time"}}},"examples":{"success":{"summary":"Report refreshed","value":{"ok":true,"message":"Report content updated","updatedAt":"2025-01-15T10:30:00Z"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Invalid request - missing capturedHtml"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found or user lacks permission"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Update failed"}},"operationId":"refreshWebReport","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/refresh\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"capturedHtml\":\"<div>Updated content</div>\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/refresh', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"capturedHtml\":\"<div>Updated content</div>\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/refresh',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"capturedHtml\":\"<div>Updated content</div>\"}\n)\ndata = response.json()"}]}},"/api/web-reports/{reportId}/views":{"get":{"summary":"Get view history for a report","description":"Retrieves paginated view history for a shared web report including timestamps, IP hashes, and user agent info. Only the report owner can access view history.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"},"description":"The unique report identifier","example":"GQHqYBdunPQKXdBKVrRBbA"},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"minimum":1,"maximum":100},"description":"Maximum number of view records to return"},{"name":"offset","in":"query","schema":{"type":"integer","default":0,"minimum":0},"description":"Number of records to skip for pagination"}],"responses":{"200":{"description":"View history retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","reportId"],"properties":{"ok":{"type":"boolean","example":true},"reportId":{"type":"string","example":"GQHqYBdunPQKXdBKVrRBbA"},"views":{"type":"array","items":{"type":"object","properties":{"viewedAt":{"type":"string","format":"date-time","example":"2025-01-15T09:00:00Z"},"ipHash":{"type":"string","description":"Anonymized IP hash","example":"a1b2c3..."},"userAgent":{"type":"string","example":"Mozilla/5.0..."},"deviceType":{"type":"string","enum":["mobile","desktop","tablet"],"example":"desktop"},"browser":{"type":"string","example":"Chrome"},"referrer":{"type":"string","nullable":true}}}},"total":{"type":"integer","description":"Total number of view records","example":125},"limit":{"type":"integer","example":50},"offset":{"type":"integer","example":0}}},"examples":{"success":{"summary":"View history retrieved","value":{"ok":true,"reportId":"GQHqYBdunPQKXdBKVrRBbA","views":[{"viewedAt":"2025-01-15T09:00:00Z","ipHash":"a1b2c3d4e5","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0","deviceType":"desktop","browser":"Chrome","referrer":null},{"viewedAt":"2025-01-14T16:30:00Z","ipHash":"f6g7h8i9j0","userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 17_0) Safari/605.1","deviceType":"mobile","browser":"Safari","referrer":"https://mail.google.com"}],"total":125,"limit":50,"offset":0}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Report not found","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"not_found"},"message":{"type":"string","example":"Report not found"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"fetch_failed"},"message":{"type":"string","example":"Failed to fetch view history"}}}}}}},"operationId":"getWebReportViews","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/EXAMPLE_ID/views\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/EXAMPLE_ID/views', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/EXAMPLE_ID/views',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/web-reports/case/{caseId}/live":{"get":{"summary":"Get live shared reports for a case","description":"Retrieves all shared web reports with live mode enabled for a specific case. Used by the client to check which reports need to be refreshed when case data is saved.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"},"description":"The case ID to get live reports for","example":"case-acme-2025"}],"responses":{"200":{"description":"Live reports retrieved successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","reports","count"],"properties":{"ok":{"type":"boolean","example":true},"reports":{"type":"array","items":{"type":"object","properties":{"reportId":{"type":"string","example":"GQHqYBdunPQKXdBKVrRBbA"},"shareUrl":{"type":"string","format":"uri","example":"https://app.trybart.com/reports/GQHqYBdunPQKXdBKVrRBbA"},"reportTitle":{"type":"string","example":"ACME Corp Benefits Comparison"},"tab":{"type":"string","example":"medical"},"watermarkEnabled":{"type":"boolean","example":false},"brandingConfig":{"type":"object","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true}}}},"count":{"type":"integer","description":"Number of live reports","example":2}}},"examples":{"success":{"summary":"Live reports for case","value":{"ok":true,"reports":[{"reportId":"GQHqYBdunPQKXdBKVrRBbA","shareUrl":"https://app.trybart.com/reports/GQHqYBdunPQKXdBKVrRBbA","reportTitle":"Acme Corp Benefits Comparison","tab":"medical","watermarkEnabled":false,"brandingConfig":null,"expiresAt":"2025-02-15T00:00:00Z"}],"count":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"fetch_failed"},"message":{"type":"string","example":"Failed to get live reports"}}}}}}},"operationId":"getLiveReportsForCase","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/web-reports/case/EXAMPLE_ID/live\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/web-reports/case/EXAMPLE_ID/live', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/web-reports/case/EXAMPLE_ID/live',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/webhooks/hubspot":{"post":{"summary":"HubSpot webhook receiver","description":"Receive webhook events from HubSpot. Validates HubSpot signature or generic webhook secret.","tags":["Webhooks"],"security":[],"parameters":[{"name":"X-HubSpot-Signature-v3","in":"header","schema":{"type":"string"},"description":"HubSpot v3 HMAC signature"},{"name":"X-HubSpot-Signature","in":"header","schema":{"type":"string"},"description":"HubSpot v1/v2 signature"}],"responses":{"200":{"description":"Webhook received successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSuccessResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Signature verification failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_webhooks_hubspot","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HubSpotWebhookPayload"},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/webhooks/hubspot\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/hubspot', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/webhooks/hubspot',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/webhooks/salesforce":{"post":{"summary":"Salesforce webhook receiver","description":"Receive webhook events from Salesforce. Validates Bearer token or HMAC signature.","tags":["Webhooks"],"security":[],"parameters":[{"name":"Authorization","in":"header","schema":{"type":"string"},"description":"Bearer token for authentication"},{"name":"x-salesforce-signature","in":"header","schema":{"type":"string"},"description":"HMAC signature"}],"responses":{"200":{"description":"Webhook received successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSuccessResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Authentication failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_webhooks_salesforce","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesforceWebhookPayload"},"examples":{"default":{"summary":"Example request","value":{}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/webhooks/salesforce\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/salesforce', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/webhooks/salesforce',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/webhooks/slack":{"post":{"summary":"Slack webhook receiver","description":"Receive webhook events from Slack Events API. Validates Slack signature and handles URL verification challenge.","tags":["Webhooks"],"security":[],"parameters":[{"name":"x-slack-request-timestamp","in":"header","schema":{"type":"string"},"description":"Unix timestamp of the request"},{"name":"x-slack-signature","in":"header","schema":{"type":"string"},"description":"Slack signature for verification"}],"responses":{"200":{"description":"Webhook received or challenge response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSuccessResponse"},"examples":{"success":{"summary":"Successful response","value":{"ok":true}}}},"text/plain":{"schema":{"type":"string"},"examples":{"challenge":{"summary":"URL verification challenge","value":"challenge_string_from_slack"}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"description":"Signature verification failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookErrorResponse"}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"operationId":"post_api_webhooks_slack","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SlackWebhookPayload"},"examples":{"url_verification":{"summary":"URL verification","value":{"type":"url_verification","challenge":"challenge_string"}},"event":{"summary":"Event callback","value":{"type":"event_callback","event_id":"Ev123","event":{}}}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/webhooks/slack\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/webhooks/slack', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/webhooks/slack',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={}\n)\ndata = response.json()"}]}},"/api/wizard/steps/2/plan-search":{"get":{"summary":"Search plan library for wizard step 2","description":"Searches the plan library with filtering by carrier, network, metal level, and name. Returns paginated results for use in the case creation wizard.","tags":["Wizard"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"carrier","in":"query","schema":{"type":"string"},"description":"Filter by carrier name","example":"UHC"},{"name":"network","in":"query","schema":{"type":"string"},"description":"Filter by network type","example":"PPO"},{"name":"metal","in":"query","schema":{"type":"string"},"description":"Filter by metal level","example":"Gold"},{"name":"name","in":"query","schema":{"type":"string"},"description":"Search by plan name","example":"PPO Gold"},{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Filter by organization ID","example":"org_123"},{"name":"limit","in":"query","schema":{"type":"integer","default":25,"minimum":1,"maximum":200},"description":"Maximum number of results"},{"name":"offset","in":"query","schema":{"type":"integer","default":0,"minimum":0},"description":"Number of results to skip"}],"responses":{"200":{"description":"Plans found successfully","content":{"application/json":{"schema":{"type":"object","required":["ok","items","count","total"],"properties":{"ok":{"type":"boolean","example":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"metadata":{"type":"object"},"plan":{"type":"object"}}}},"count":{"type":"integer","description":"Number of items in this page","example":25},"total":{"type":"integer","description":"Total matching items","example":150},"query":{"type":"object","description":"Applied query filters","properties":{"carrier":{"type":"string"},"network":{"type":"string"},"metal":{"type":"string"},"name":{"type":"string"}}},"orgId":{"type":"string","nullable":true},"ts":{"type":"string","format":"date-time"}}},"examples":{"success":{"value":{"ok":true,"plans":[{"id":"plan1","name":"PPO Gold","carrier":"UHC"}],"total":1}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Organization access denied","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"org_access_denied"},"message":{"type":"string","example":"You do not have access to this organization"}}}}}},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"501":{"description":"CloudSQL disabled"},"503":{"description":"Plan library unavailable"}},"operationId":"wizardPlanSearch","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/wizard/steps/2/plan-search\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/wizard/steps/2/plan-search', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/wizard/steps/2/plan-search',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]}},"/api/wizard/steps/2/validate":{"post":{"summary":"Validate wizard step 2 plan data","description":"Validates plan data entered in wizard step 2. Checks for missing names, tiers, and rates across all plans and benefit types.","tags":["Wizard"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plans":{"type":"array","description":"Array of plans to validate (alternative to planData)","items":{"type":"object"}},"planData":{"type":"object","description":"Plans organized by benefit type (alternative to plans array)","additionalProperties":{"type":"array","items":{"type":"object"}},"example":{"medical":[{"planName":"PPO Gold","tiers":[]}],"dental":[{"planName":"DMO Basic"}]}}}},"examples":{"default":{"value":{"plans":[{"id":"plan1","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650}}}]}}}}}},"responses":{"200":{"description":"Validation completed","content":{"application/json":{"schema":{"type":"object","required":["ok","summary","issues","byType","valid"],"properties":{"ok":{"type":"boolean","example":true},"summary":{"type":"object","properties":{"totalPlans":{"type":"integer","example":5},"missingNames":{"type":"integer","example":0},"missingTiers":{"type":"integer","example":1},"missingRates":{"type":"integer","example":0}}},"issues":{"type":"object","properties":{"missingNames":{"type":"array","items":{"type":"object"}},"missingTiers":{"type":"array","items":{"type":"object"}},"missingRates":{"type":"array","items":{"type":"object"}}}},"byType":{"type":"object","description":"Validation results by benefit type","additionalProperties":{"type":"object","properties":{"total":{"type":"integer"},"missingNames":{"type":"integer"},"missingTiers":{"type":"integer"},"missingRates":{"type":"integer"},"issueCount":{"type":"integer"}}}},"valid":{"type":"boolean","description":"True if no validation issues","example":true}}},"examples":{"success":{"value":{"ok":true,"valid":true,"warnings":[]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}},"500":{"description":"Validation failed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"validation_failed"},"message":{"type":"string"}}}}}}},"operationId":"wizardValidateStep2","x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X POST \"https://app.trybart.com/api/wizard/steps/2/validate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"plans\":[]}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/wizard/steps/2/validate', {\n  method: 'POST',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"plans\":[]})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.post(\n    'https://app.trybart.com/api/wizard/steps/2/validate',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"plans\":[]}\n)\ndata = response.json()"}]}},"/api/plan-library/bulk-share":{"put":{"summary":"Bulk update sharing settings","description":"Update sharing settings for multiple plan library items at once. Only the owner of each item can modify its sharing settings. Items you don't own will be skipped.","operationId":"bulkUpdatePlanLibrarySharing","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"x-rateLimit":{"limit":10,"window":"1m","description":"10 requests per minute"},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","description":"Array of items to update with their sharing settings","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","description":"Plan library item ID"},"sharedOrgIds":{"type":"array","description":"Organization IDs to share with","items":{"type":"string"}},"sharedEmailDomains":{"type":"array","description":"Email domains that can access this item","items":{"type":"string"}}}}}}},"examples":{"bulk-share":{"summary":"Share multiple items with organizations","value":{"items":[{"id":"lib-ppo-gold","sharedOrgIds":["org_123","org_456"]},{"id":"lib-hdhp-silver","sharedOrgIds":["org_123"],"sharedEmailDomains":["partner.com"]}]}}}}}},"responses":{"200":{"description":"Bulk update results","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"updated":{"type":"array","description":"IDs of successfully updated items","items":{"type":"string"}},"skipped":{"type":"array","description":"IDs of items skipped (not owner or not found)","items":{"type":"string"}},"errors":{"type":"array","description":"Errors encountered during update","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"error":{"type":"string","description":"Error message if failed"}}}}}},"examples":{"success":{"summary":"Successful bulk update","value":{"ok":true,"updated":["lib-ppo-gold","lib-hdhp-silver"],"skipped":[],"errors":[]}},"partial":{"summary":"Partial success with some skipped","value":{"ok":true,"updated":["lib-ppo-gold"],"skipped":["lib-not-owned"],"errors":[]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/plan-library/bulk-share\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"planIds\":[\"plan1\"],\"visibility\":\"organization\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/bulk-share', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"planIds\":[\"plan1\"],\"visibility\":\"organization\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/plan-library/bulk-share',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"planIds\":[\"plan1\"],\"visibility\":\"organization\"}\n)\ndata = response.json()"}]}},"/api/plan-library/{id}/share":{"get":{"summary":"Get sharing settings","description":"Retrieve the current sharing settings for a plan library item, including organizations and email domains it's shared with.","operationId":"getPlanLibrarySharing","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Plan library item ID","schema":{"type":"string"}}],"responses":{"200":{"description":"Sharing settings retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"itemId":{"type":"string","description":"The plan library item ID"},"ownerId":{"type":"string","description":"User ID of the item owner"},"isOwner":{"type":"boolean","description":"Whether the requesting user owns this item"},"visibility":{"type":"string","enum":["private","org","shared"],"description":"Current visibility level"},"sharedOrgIds":{"type":"array","description":"Organization IDs this item is shared with","items":{"type":"string"}},"sharedOrgs":{"type":"array","description":"Organization details for shared orgs","items":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"}}}},"sharedEmailDomains":{"type":"array","description":"Email domains that can access this item","items":{"type":"string"}}}},"examples":{"owner-view":{"summary":"Owner viewing their shared item","value":{"ok":true,"itemId":"lib-ppo-gold","ownerId":"user_abc123","isOwner":true,"visibility":"shared","sharedOrgIds":["org_xyz789"],"sharedOrgs":[{"id":"org_xyz789","name":"Benefits Consulting Group"}],"sharedEmailDomains":["partner.com"]}},"private-item":{"summary":"Private item with no sharing","value":{"ok":true,"itemId":"lib-custom-plan","ownerId":"user_abc123","isOwner":true,"visibility":"private","sharedOrgIds":[],"sharedOrgs":[],"sharedEmailDomains":[]}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"description":"Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":0}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}},"Retry-After":{"description":"Seconds until rate limit resets","schema":{"type":"integer","example":30}}},"content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"rate_limit_exceeded"},"message":{"type":"string","example":"Rate limit exceeded: 60 requests per minute"},"limit":{"type":"integer","example":60},"window":{"type":"string","enum":["minute","day"],"example":"minute"},"retryAfter":{"type":"integer","example":30}}},"example":{"success":false,"error":"rate_limit_exceeded","message":"Rate limit exceeded: 60 requests per minute","limit":60,"window":"minute","retryAfter":30}}}}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X GET \"https://app.trybart.com/api/plan-library/EXAMPLE_ID/share\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\""},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID/share', {\n  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.get(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID/share',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'}\n)\ndata = response.json()"}]},"put":{"summary":"Update sharing settings","description":"Update the sharing settings for a plan library item. Only the owner can modify sharing settings.","operationId":"updatePlanLibrarySharing","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"x-rateLimit":{"limit":30,"window":"1m","description":"30 requests per minute"},"parameters":[{"name":"id","in":"path","required":true,"description":"Plan library item ID","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sharedOrgIds":{"type":"array","description":"Organization IDs to share with (replaces existing)","items":{"type":"string"}},"sharedEmailDomains":{"type":"array","description":"Email domains that can access (replaces existing)","items":{"type":"string"}},"visibility":{"type":"string","enum":["private","org","shared"],"description":"Visibility level for the item"}}},"examples":{"share-with-orgs":{"summary":"Share with specific organizations","value":{"sharedOrgIds":["org_xyz789","org_abc456"],"visibility":"shared"}},"share-by-domain":{"summary":"Share with email domains","value":{"sharedEmailDomains":["partner.com","client.com"],"visibility":"shared"}},"make-private":{"summary":"Make item private","value":{"sharedOrgIds":[],"sharedEmailDomains":[],"visibility":"private"}}}}}},"responses":{"200":{"description":"Sharing settings updated","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"itemId":{"type":"string"},"sharedOrgIds":{"type":"array","items":{"type":"string"}},"sharedEmailDomains":{"type":"array","items":{"type":"string"}},"visibility":{"type":"string","description":"Visibility setting (private, org, shared)"}}},"examples":{"success":{"value":{"ok":true,"itemId":"lib-ppo-gold","sharedOrgIds":["org_xyz789"],"sharedEmailDomains":["partner.com"],"visibility":"shared"}}}}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed per minute","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window","schema":{"type":"integer","example":57}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer","example":1704067260}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"x-codeSamples":[{"lang":"curl","label":"cURL","source":"curl -X PUT \"https://app.trybart.com/api/plan-library/EXAMPLE_ID/share\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"visibility\":\"organization\"}'"},{"lang":"javascript","label":"JavaScript","source":"const response = await fetch('https://app.trybart.com/api/plan-library/EXAMPLE_ID/share', {\n  method: 'PUT',\n  headers: {\n    'Authorization': 'Bearer YOUR_TOKEN',\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"visibility\":\"organization\"})\n});\nconst data = await response.json();"},{"lang":"python","label":"Python","source":"import requests\n\nresponse = requests.put(\n    'https://app.trybart.com/api/plan-library/EXAMPLE_ID/share',\n    headers={'Authorization': 'Bearer YOUR_TOKEN'},\n    json={\"visibility\":\"organization\"}\n)\ndata = response.json()"}]}},"/api/webhooks/event-types":{"get":{"summary":"List available webhook event types","description":"Returns a list of all available event types that can be subscribed to via webhooks.","tags":["Webhook Subscriptions"],"responses":{"200":{"description":"List of event types","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"eventTypes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","example":"case.created"},"description":{"type":"string"}}}}}},"example":{"ok":true,"eventTypes":["case.created","case.updated","report.generated"]}}}}},"operationId":"getApiWebhooksEventTypes"}},"/api/webhooks/subscriptions":{"get":{"summary":"List webhook subscriptions","description":"Returns all webhook subscriptions for the organization.","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["active","paused","disabled"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"List of subscriptions","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"401":{"description":"Unauthorized"}},"operationId":"getApiWebhooksSubscriptions"},"post":{"summary":"Create webhook subscription","description":"Create a new webhook subscription. The signing secret is returned only in this response.","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","url","eventTypes"],"properties":{"name":{"type":"string","maxLength":100},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string"}},"headers":{"type":"object","additionalProperties":{"type":"string"}},"timeoutMs":{"type":"integer","minimum":1000,"maximum":60000,"default":30000}}},"example":{"endpoint":"https://example.com/webhooks/bart","events":["case.created","case.updated"],"secret":"whsec_example"}}}},"responses":{"201":{"description":"Subscription created with signing secret"},"400":{"description":"Validation error"},"401":{"description":"Unauthorized"}},"operationId":"postApiWebhooksSubscriptions"}},"/api/webhooks/subscriptions/{id}":{"get":{"summary":"Get webhook subscription","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Subscription details","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Not found"}},"operationId":"getApiWebhooksSubscriptionsById"},"put":{"summary":"Update webhook subscription","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["active","paused"]}}},"example":{"events":["case.created","report.generated"],"active":true}}}},"responses":{"200":{"description":"Updated subscription","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Not found"}},"operationId":"putApiWebhooksSubscriptionsById"},"delete":{"summary":"Delete webhook subscription","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Not found"}},"operationId":"deleteApiWebhooksSubscriptionsById"}},"/api/webhooks/test":{"post":{"summary":"Send test webhook","description":"Send a test webhook to verify endpoint configuration.","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["subscriptionId"],"properties":{"subscriptionId":{"type":"string"}}},"example":{"endpoint":"https://example.com/webhooks/bart","eventType":"case.created","payload":{"id":"case_123"}}}}},"responses":{"200":{"description":"Test result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}}},"operationId":"postApiWebhooksTest"}},"/api/webhooks/deliveries":{"get":{"summary":"List webhook deliveries","description":"Returns delivery history for a subscription.","tags":["Webhook Subscriptions"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"subscriptionId","in":"query","required":true,"schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer"}},{"name":"offset","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Delivery history","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}}},"operationId":"getApiWebhooksDeliveries"}},"/api/jobs":{"get":{"summary":"List jobs","description":"Returns async jobs for the authenticated user.","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"type","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","default":20}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"List of jobs with pagination","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}}},"operationId":"getApiJobs"}},"/api/jobs/{id}":{"get":{"summary":"Get job status","description":"Returns the status and result of a specific job.","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job status","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"job":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","failed","cancelled"]},"progress":{"type":"integer"},"result":{"type":"object"},"error":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}},"example":{"ok":true,"job":{"id":"job_123","status":"running","progress":45}}}}},"404":{"description":"Job not found"}},"operationId":"getApiJobsById"},"delete":{"summary":"Cancel job","description":"Cancel a queued job. Only jobs with status 'queued' can be cancelled.","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Job not found"},"409":{"description":"Job cannot be cancelled in current state"}},"operationId":"deleteApiJobsById"}},"/api/jobs/{id}/result":{"get":{"summary":"Get job result","description":"Returns just the result of a completed job.","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Job not found"},"409":{"description":"Job not completed"}},"operationId":"getApiJobsByIdResult"}},"/api/cases/{caseId}/plans/links":{"get":{"summary":"List plan links","description":"Returns all plan links for a case.","tags":["Plan Linking"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"linkType","in":"query","schema":{"type":"string","enum":["renewal","proposed","alternate"]}}],"responses":{"200":{"description":"List of plan links","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Case not found"}},"operationId":"getApiCasesByCaseidPlansLinks"},"delete":{"summary":"Delete all plan links","description":"Delete all links for a case, optionally filtered by plan or type.","tags":["Plan Linking"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"query","schema":{"type":"string"}},{"name":"linkType","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Links deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}}},"operationId":"deleteApiCasesByCaseidPlansLinks"}},"/api/cases/{caseId}/plans/link":{"post":{"summary":"Create plan link","description":"Link two plans together (e.g., current to renewal).","tags":["Plan Linking"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sourceId","targetId","linkType"],"properties":{"sourceId":{"type":"string","description":"Source plan ID (usually current)"},"targetId":{"type":"string","description":"Target plan ID (renewal/proposed)"},"linkType":{"type":"string","enum":["renewal","proposed","alternate"]}}},"example":{"currentPlanId":"plan_current_1","renewalPlanId":"plan_renewal_1"}}}},"responses":{"201":{"description":"Link created"},"400":{"description":"Validation error"},"404":{"description":"Case or plan not found"}},"operationId":"postApiCasesByCaseidPlansLink"}},"/api/cases/{caseId}/plans/link/{linkId}":{"delete":{"summary":"Delete plan link","tags":["Plan Linking"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"linkId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Link deleted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Link not found"}},"operationId":"deleteApiCasesByCaseidPlansLinkByLinkid"}},"/api/error-codes":{"get":{"summary":"List all error codes","description":"Returns comprehensive documentation of all API error codes.","tags":["Error Codes"],"parameters":[{"name":"category","in":"query","schema":{"type":"string"},"description":"Filter by category"},{"name":"retryable","in":"query","schema":{"type":"boolean"},"description":"Filter by retryable status"}],"responses":{"200":{"description":"Error code reference","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"codes":{"type":"object"},"categories":{"type":"array","items":{"type":"string"}},"httpStatusReference":{"type":"object"}}},"example":{"ok":true,"codes":[{"code":"unauthorized","message":"Authentication required"}]}}}}},"operationId":"getApiErrorCodes"}},"/api/error-codes/{code}":{"get":{"summary":"Get error code details","description":"Returns detailed information about a specific error code.","tags":["Error Codes"],"parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Error code details","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"message":"Success"}}}},"404":{"description":"Error code not found"}},"operationId":"getApiErrorCodesByCode"}},"/api/cases/{id}/share-link/email":{"post":{"summary":"Email a case share link","description":"Emails an existing share URL to a recipient for the specified case.","tags":["Cases","Email"],"security":[{"bearerAuth":[]}],"operationId":"emailCaseShareLink","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"shareUrl":{"type":"string","format":"uri"}},"required":["email","shareUrl"]},"example":{"email":"broker@example.com","shareUrl":"https://app.trybart.com/app.html?shared=tok_123"}}}},"responses":{"200":{"description":"Share link email sent successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"email":{"type":"string","format":"email"},"messageId":{"type":"string"}},"required":["ok","email"]},"example":{"ok":true,"email":"broker@example.com","messageId":"msg_abc123"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/cases/{id}/files":{"get":{"summary":"Get signed URLs for case files","description":"Returns signed URLs for the case JSON blob and discovered source files associated with the case.","tags":["Cases","Files"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"getCaseFiles","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"},{"name":"expires","in":"query","required":false,"schema":{"type":"integer","minimum":60,"maximum":86400,"default":900},"description":"Signed URL expiration in seconds"}],"responses":{"200":{"description":"Case files returned","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"caseId":{"type":"string"},"files":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["case-data","source-file","file"]},"url":{"type":"string","format":"uri"},"expiresIn":{"type":"integer"}},"required":["key","name","type","url","expiresIn"]}},"totalFiles":{"type":"integer"},"expiresIn":{"type":"integer"}},"required":["ok","caseId","files","totalFiles","expiresIn"]},"example":{"ok":true,"caseId":"case_abc123","files":[{"key":"cases/user_1/case_abc123.json","name":"case_abc123.json","type":"case-data","url":"https://example-presigned-url","expiresIn":900}],"totalFiles":1,"expiresIn":900}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/cases/{id}/zip":{"get":{"summary":"Download case files ZIP","description":"Streams a ZIP archive containing case JSON and associated source files.","tags":["Cases","Files"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"getCaseFilesZip","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"responses":{"200":{"description":"ZIP archive stream","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/cases/{id}/duplicate":{"post":{"summary":"Duplicate a case","description":"Creates a duplicate of the specified case, including stored case payload data.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"duplicateCase","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Unique identifier"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"newEmployerName":{"type":"string","description":"Optional name for the duplicated case"}}},"example":{"newEmployerName":"Acme Corp (Renewal Copy)"}}}},"responses":{"200":{"description":"Case duplicated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"id":{"type":"string"},"sourceId":{"type":"string"},"employerName":{"type":"string"},"message":{"type":"string"}},"required":["ok","id","sourceId"]},"example":{"ok":true,"id":"case-new123","sourceId":"case-old123","employerName":"Acme Corp (Copy)","message":"Case duplicated successfully"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/plan-library/org-stats":{"get":{"summary":"Get plan counts by organization","description":"Returns organization-level plan counts for organizations the current user belongs to.","tags":["Plan Library"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"getPlanLibraryOrgStats","responses":{"200":{"description":"Organization plan stats","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"orgStats":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string"},"orgName":{"type":"string"},"role":{"type":"string"},"planCount":{"type":"integer"},"error":{"type":"boolean"}},"required":["orgId","orgName","role","planCount"]}},"totalOrgs":{"type":"integer"},"orgsWithPlans":{"type":"integer"},"ts":{"type":"string","format":"date-time"}},"required":["ok","orgStats","totalOrgs","orgsWithPlans","ts"]},"example":{"ok":true,"orgStats":[{"orgId":"org_1","orgName":"Acme Benefits","role":"owner","planCount":12}],"totalOrgs":1,"orgsWithPlans":1,"ts":"2026-04-18T00:00:00.000Z"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/organizations/{orgId}/sync-my-cases":{"post":{"summary":"Sync user cases into organization","description":"Moves user-owned cases that are outside the target organization into the target organization.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"operationId":"syncMyCasesToOrganization","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization identifier"},{"name":"preview","in":"query","required":false,"schema":{"type":"boolean"},"description":"Dry-run preview mode when true"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"caseIds":{"type":"array","items":{"type":"string"}},"preview":{"type":"boolean"}}},"example":{"caseIds":["case_1","case_2"],"preview":false}}}},"responses":{"200":{"description":"Sync result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"preview":{"type":"boolean"},"synced":{"type":"integer"},"casesToSync":{"type":"integer"},"cases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"employerName":{"type":"string"},"currentOrgId":{"type":"string","nullable":true}}}},"message":{"type":"string"}},"required":["ok"]},"example":{"ok":true,"synced":2,"cases":[{"id":"case_1","employerName":"Acme Corp"},{"id":"case_2","employerName":"Beta LLC"}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/organizations/{orgId}/sync-my-cases/preview":{"get":{"summary":"Preview cases eligible for org sync","description":"Returns a preview list of user-owned cases that can be synced into the target organization.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"operationId":"previewSyncMyCasesToOrganization","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"},"description":"Organization identifier"}],"responses":{"200":{"description":"Preview result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"casesToSync":{"type":"integer"},"cases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"employerName":{"type":"string"},"currentOrgId":{"type":"string","nullable":true}},"required":["id"]}}},"required":["ok","casesToSync","cases"]},"example":{"ok":true,"casesToSync":1,"cases":[{"id":"case_1","employerName":"Acme Corp","currentOrgId":null}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/plan-folders":{"get":{"summary":"List folders","description":"List all plan folders for the authenticated user","tags":["plan-folders"],"responses":{"200":{"description":"List of folders","content":{"application/json":{"schema":{"type":"object","properties":{"folders":{"type":"array","items":{"$ref":"#/components/schemas/PlanFolder"}}}},"examples":{"response":{"summary":"Folder list","value":{"folders":[{"id":"f_001","name":"Medical Plans","visibility":"private","isOwn":true,"planCount":5,"createdAt":"2025-01-01T00:00:00Z","updatedAt":"2025-01-01T00:00:00Z","metadata":{}}]}}}}}}},"operationId":"getPlanFolders"},"post":{"summary":"Create folder","description":"Create a new plan folder","tags":["plan-folders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Folder name"},"external_id":{"type":"string","description":"External identifier"},"parent_id":{"type":"string","format":"uuid","nullable":true,"description":"Parent folder ID (UUID)"},"visibility":{"type":"string","enum":["private","shared"],"description":"Folder visibility"}}}}}},"responses":{"201":{"description":"Folder created"},"400":{"description":"Bad request"},"409":{"description":"Conflict"}},"operationId":"postPlanFolders"}},"/api/v1/plan-folders/{id}":{"patch":{"summary":"Update folder","description":"Update a plan folder","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"responses":{"200":{"description":"Folder updated","content":{"application/json":{"schema":{"type":"object","properties":{"folder":{"$ref":"#/components/schemas/PlanFolder"}}}}}},"403":{"description":"Forbidden"},"404":{"description":"Not found"},"409":{"description":"Conflict"}},"operationId":"patchPlanFoldersId"},"delete":{"summary":"Soft-delete folder","description":"Soft-delete a plan folder","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"responses":{"204":{"description":"Folder deleted"},"403":{"description":"Forbidden"},"404":{"description":"Not found"}},"operationId":"deletePlanFoldersId"}},"/api/v1/plan-folders/{id}/move-plans":{"post":{"summary":"Move plans into folder","description":"Move plans into a specific folder","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Folder ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["planExternalIds"],"properties":{"planExternalIds":{"type":"array","items":{"type":"string"},"description":"Array of plan external IDs to move"}}}}}},"responses":{"200":{"description":"Move result","content":{"application/json":{"schema":{"type":"object","properties":{"moved":{"type":"integer"},"skipped":{"type":"integer"},"targetFolderId":{"type":"string","nullable":true}}}}}},"403":{"description":"Forbidden"}},"operationId":"postPlanFoldersIdMovePlans"}},"/api/v1/plan-folders/{id}/restore":{"post":{"summary":"Restore soft-deleted folder","description":"Restore a soft-deleted plan folder","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"responses":{"200":{"description":"Folder restored","content":{"application/json":{"schema":{"type":"object","properties":{"folder":{"$ref":"#/components/schemas/PlanFolder"}}}}}},"404":{"description":"Not found"}},"operationId":"postPlanFoldersIdRestore"}},"/api/v1/plan-folders/{id}/acl":{"get":{"summary":"List folder access grants","description":"List active read/write/admin grants for a folder. Visible to anyone who can read the folder so collaborators can see who else has access.","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"responses":{"200":{"description":"ACL grants","content":{"application/json":{"schema":{"type":"object","properties":{"acl":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"folder_id":{"type":"string","format":"uuid"},"principal_type":{"type":"string","enum":["user","org","domain"]},"principal_id":{"type":"string"},"permission":{"type":"string","enum":["read","write","admin"]},"granted_by":{"type":"string"},"granted_at":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden — caller cannot read this folder"},"404":{"description":"Folder not found"}},"operationId":"getPlanFoldersIdAcl"},"post":{"summary":"Grant folder access","description":"Grant read/write/admin permission on a folder to a user, org, or email domain. Idempotent — re-granting the same principal updates the permission level. Owner OR existing admin grant required.","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["principal_type","principal_id","permission"],"properties":{"principal_type":{"type":"string","enum":["user","org","domain"]},"principal_id":{"type":"string","description":"user_id (UUID), org_id, or email domain (e.g. paychex.com)"},"permission":{"type":"string","enum":["read","write","admin"]}}}}}},"responses":{"201":{"description":"Grant created or updated","content":{"application/json":{"schema":{"type":"object","properties":{"acl":{"type":"object"}}}}}},"400":{"description":"Invalid principal_type, permission, or principal_id"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden — caller is not owner or admin"},"404":{"description":"Folder not found"}},"operationId":"postPlanFoldersIdAcl"},"delete":{"summary":"Revoke folder access grant","description":"Revoke an active grant by principal triple. Sets revoked_at on the row and writes an audit entry. Owner OR existing admin grant required.","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["principal_type","principal_id"],"properties":{"principal_type":{"type":"string","enum":["user","org","domain"]},"principal_id":{"type":"string"}}}}}},"responses":{"204":{"description":"Grant revoked"},"400":{"description":"Invalid principal_type or principal_id"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden — caller is not owner or admin"},"404":{"description":"Folder not found, or no active grant for that principal"}},"operationId":"deletePlanFoldersIdAcl"}},"/api/v1/plan-folders/{id}/acl/audit":{"get":{"summary":"List folder access audit log","description":"Append-only history of grant/revoke/update events on a folder's ACL. Admin-only — non-admin readers might be able to see folder content but should not see who else was granted/revoked. Newest events first.","tags":["plan-folders"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Folder ID"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":1000,"default":100},"description":"Max audit rows to return (server-clamped)"}],"responses":{"200":{"description":"Audit log entries","content":{"application/json":{"schema":{"type":"object","properties":{"audit":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"folder_id":{"type":"string","format":"uuid"},"principal_type":{"type":"string","enum":["user","org","domain"]},"principal_id":{"type":"string"},"permission":{"type":"string","enum":["read","write","admin"],"nullable":true,"description":"Permission at time of action; null on revoke if the prior grant could not be located"},"action":{"type":"string","enum":["grant","revoke","update"]},"actor_user_id":{"type":"string"},"actor_email":{"type":"string","nullable":true},"metadata":{"type":"object"},"created_at":{"type":"string","format":"date-time"}}}}}}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden — admin grant required"},"404":{"description":"Folder not found"}},"operationId":"getPlanFoldersIdAclAudit"}},"/api/enrollment-portal/sessions/{id}/detail":{"get":{"summary":"Get session detail with embedded forms","description":"Returns the full session record plus its forms (per-employee status + magic-link URLs).","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Session detail","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"session":{"$ref":"#/components/schemas/EnrollmentPortalSession"},"forms":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentPortalForm"}},"viewerIsOwner":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsIdDetail"}},"/api/enrollment-portal/sessions/{id}":{"delete":{"summary":"Soft-delete an enrollment session","description":"Marks the session as deleted but preserves it for restore. Forms remain accessible to employees with active magic links.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Soft-deleted","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"sessionId":{"type":"string"},"status":{"type":"string","enum":["deleted"]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"deleteEnrollmentPortalSessionsId"},"patch":{"summary":"Update session metadata (currently: electionDeadline)","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["electionDeadline"],"properties":{"electionDeadline":{"type":"string","format":"date-time","description":"Must be in the future"}}}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"sessionId":{"type":"string"},"electionDeadline":{"type":"string","format":"date-time"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"patchEnrollmentPortalSessionsId"},"get":{"summary":"Get a single session (legacy enrollment-portal handler)","description":"Returns the full session record. Predates GET /sessions/{id}/detail; new integrations should prefer that route.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"deprecated":true,"responses":{"200":{"description":"Session record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentPortalSession"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsId"}},"/api/enrollment-portal/sessions/{id}/restore":{"post":{"summary":"Restore a soft-deleted session","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"sessionId":{"type":"string"},"status":{"type":"string","nullable":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsIdRestore"}},"/api/enrollment-portal/sessions/{id}/forms":{"post":{"summary":"Add an employee to the session roster","description":"Generates a new form + magic-link URL for the added employee.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["firstName","lastName"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"dob":{"type":"string","format":"date","nullable":true},"ssn4":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true}}}}}},"responses":{"201":{"description":"Form created","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["formId","magicLinkUrl"],"properties":{"formId":{"type":"string"},"magicLinkUrl":{"type":"string","format":"uri"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsIdForms"}},"/api/enrollment-portal/forms/{formId}":{"delete":{"summary":"Remove an employee form from the session roster","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Form removed","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"formId":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"deleteEnrollmentPortalFormsFormId"}},"/api/enrollment-portal/sessions/{id}/claim":{"post":{"summary":"Claim an orphaned session (rescue route)","description":"Used when a session has no owner (e.g., owner deleted account). Caller becomes the new owner if they have access to the underlying case.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Claimed","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"sessionId":{"type":"string"},"claimedBy":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsIdClaim"}},"/api/enrollment-portal/sessions/{id}/elections.csv":{"get":{"summary":"Export submitted elections as CSV","description":"Returns text/csv with one row per form/election. Filename is \"election-portal-<sessionId>.csv\".","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"CSV file","content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsIdElections.csv"}},"/api/enrollment-portal/forms/{formId}/invite":{"post":{"summary":"Send an invitation email to a single employee","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Invitation sent","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"formId":{"type":"string"},"sent":{"type":"boolean"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalFormsFormIdInvite"}},"/api/enrollment-portal/sessions/{id}/invites/send-all":{"post":{"summary":"Bulk-send invitations to pending employees","description":"Sends invites to all eligible (e.g., pending) forms in the session. Returns per-form sent/failed counts.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"scope":{"type":"string","enum":["pending","all","reminders"],"description":"Default: pending"}}}}}},"responses":{"200":{"description":"Bulk send result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentInviteResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsIdInvitesSendAll"}},"/api/enrollment-portal/sessions/{sessionId}/send-invites":{"post":{"summary":"[Legacy] Send invitations via enrollment-portal.js","description":"Predates the newer POST /sessions/{id}/invites/send-all. Use the newer route for new integrations.","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"deprecated":true,"responses":{"200":{"description":"Send result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sent":{"type":"integer"},"failed":{"type":"integer"},"total":{"type":"integer"}}},"examples":{"response":{"summary":"Invites sent","value":{"success":true,"sent":5,"failed":0,"total":5}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsSessionIdSendInvites"}},"/api/enrollment-portal/sessions/{sessionId}/send-reminders":{"post":{"summary":"Send reminder emails to employees with pending forms","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Reminder send result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sentReminders":{"type":"integer"},"total":{"type":"integer"}}},"examples":{"response":{"summary":"Reminders sent","value":{"success":true,"sentReminders":3,"total":5}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsSessionIdSendReminders"}},"/api/enrollment-portal/sessions/{sessionId}/share-link":{"get":{"summary":"Get a shareable URL for the session enrollment portal","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsSessionIdShareLink"}},"/api/enrollment-portal/resume/{token}":{"get":{"summary":"Resume an in-progress form from a saved-progress token","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Resumed form context","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"employerName":{"type":"string"},"sessionName":{"type":"string"},"primaryColor":{"type":"string"},"employerLogoUrl":{"type":"string","nullable":true}}},"examples":{"response":{"summary":"Session resume","value":{"sessionId":"sess_abc","employerName":"Acme Corp","sessionName":"2025 Open Enrollment","primaryColor":"#0284c7"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalResumeToken"}},"/api/enrollment-portal/i18n/{locale}":{"get":{"summary":"Localization strings for the employee portal","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"locale","in":"path","required":true,"schema":{"type":"string","example":"en"}}],"responses":{"200":{"description":"Locale string map","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}},"404":{"$ref":"#/components/responses/NotFound"}},"operationId":"getEnrollmentPortalI18nLocale"}},"/api/enrollment-portal/signing/sessions":{"post":{"summary":"Create a v1 PDF-signing session","description":"One enrollment form per employee. Each employee may carry a base64 pre-filled PDF in formData; SSN last 4 is bcrypt-hashed and DOB encrypted at rest. Separate from the v2 Election Portal (POST /api/enrollment-portal/sessions).","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"postEnrollmentPortalSigningSessions","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["employerName","employees"],"properties":{"employerName":{"type":"string"},"sessionName":{"type":"string"},"accessCode":{"type":"string"},"templatePdfS3Key":{"type":"string"},"signatureFields":{"type":"object","additionalProperties":true},"settings":{"type":"object","additionalProperties":true},"securitySettings":{"type":"object","additionalProperties":true},"employees":{"type":"array","items":{"type":"object","required":["firstName","lastName"],"properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"dob":{"type":"string"},"dateOfBirth":{"type":"string"},"ssn4":{"type":"string"},"ssnLast4":{"type":"string"},"formData":{"type":"string","description":"Base64 pre-filled PDF."}}}}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sessionId":{"type":"string","format":"uuid"},"portalUrl":{"type":"string"},"formCount":{"type":"integer"},"forms":{"type":"array","items":{"type":"object","additionalProperties":true}},"expiresAt":{"type":"string","format":"date-time"},"partialFailure":{"type":"boolean"},"failedForms":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}},"get":{"summary":"List the caller's v1 PDF-signing sessions","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"operationId":"getEnrollmentPortalSigningSessions","responses":{"200":{"description":"Sessions, newest first (max 100). Excludes v2 election sessions and soft-deleted rows.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"employerName":{"type":"string"},"sessionName":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"totalForms":{"type":"integer"},"signedCount":{"type":"integer"},"status":{"type":"string","enum":["active","completed","expired"]},"sessionType":{"type":"string"},"portalUrl":{"type":"string"}}}}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/enrollment-portal/signing/sessions/{sessionId}/public":{"get":{"summary":"Public info for a v1 PDF-signing session","description":"Read by the /enroll/ employee page before identity verification.","tags":["Election Portal: Employee"],"security":[],"operationId":"getEnrollmentPortalSigningSessionsSessionIdPublic","parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Session info","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"employerName":{"type":"string"},"sessionName":{"type":"string","nullable":true},"requireDob":{"type":"boolean"},"requireSsn4":{"type":"boolean"},"requiresCode":{"type":"boolean"},"captchaEnabled":{"type":"boolean"},"captchaSiteKey":{"type":"string","nullable":true},"employerLogoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string"},"allowEdits":{"type":"boolean"},"sessionType":{"type":"string"}}}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"410":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"500":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/enrollment-portal/sessions/{sessionId}/verify":{"post":{"summary":"Request access-code or OTP for the session (step 1 of auth)","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"email":{"type":"string","format":"email"},"accessCode":{"type":"string"}}},"examples":{"request":{"summary":"Verify with access code","value":{"firstName":"John","lastName":"Doe","dob":"1990-01-15","ssn4":"1234","accessCode":"ABC123"}}}}}},"responses":{"200":{"description":"Verification accepted; OTP sent if applicable","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"otpRequired":{"type":"boolean"},"formId":{"type":"string"},"email":{"type":"string"},"expiresIn":{"type":"integer"},"message":{"type":"string"}}},"examples":{"response":{"summary":"OTP required response","value":{"success":true,"otpRequired":true,"formId":"f_abc123","email":"jo***@acme.com","expiresIn":600,"message":"A verification code has been sent to your email."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsSessionIdVerify"}},"/api/enrollment-portal/forms/{formId}/verify-otp":{"post":{"summary":"Submit OTP code to obtain a magic session token","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["otp"],"properties":{"otp":{"type":"string","minLength":4,"maxLength":8}}},"examples":{"request":{"summary":"Submit OTP","value":{"otp":"123456"}}}}}},"responses":{"200":{"description":"OTP accepted; magic session token issued","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"formId":{"type":"string"},"employeeName":{"type":"string"},"status":{"type":"string","enum":["ready","signed"]},"alreadySigned":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time","nullable":true},"filledPdfS3Key":{"type":"string","nullable":true},"signedPdfS3Key":{"type":"string","nullable":true},"allowDownload":{"type":"boolean"},"allowEdits":{"type":"boolean"},"editableFields":{"type":"object"},"employerName":{"type":"string"},"sessionName":{"type":"string"},"primaryColor":{"type":"string"},"employerLogoUrl":{"type":"string","nullable":true},"demographics":{"type":"object"},"dependents":{"type":"array","items":{"type":"object"}},"sessionType":{"type":"string","enum":["signing","election"]},"planData":{"type":"object"},"electionDeadline":{"type":"string","format":"date-time","nullable":true},"allowTierSelection":{"type":"boolean"},"defaultTier":{"type":"string"},"employeeTier":{"type":"string"},"election":{"type":"object","nullable":true}}},"examples":{"response":{"summary":"Verified access with form data","value":{"success":true,"formId":"f_abc123","employeeName":"John Doe","status":"ready","alreadySigned":false,"allowDownload":true,"allowEdits":false,"employerName":"Acme Corp","sessionName":"2025 Open Enrollment","primaryColor":"#0284c7","sessionType":"signing"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalFormsFormIdVerifyOtp"}},"/api/enrollment-portal/forms/{formId}/resend-otp":{"post":{"summary":"Re-issue OTP after expiry","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OTP resent","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"email":{"type":"string"},"expiresIn":{"type":"integer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalFormsFormIdResendOtp"}},"/api/enrollment-portal/forms/{formId}/timeout-status":{"get":{"summary":"Check time remaining on the form session","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Timeout status","content":{"application/json":{"schema":{"type":"object","properties":{"expired":{"type":"boolean"},"remainingSeconds":{"type":"integer"},"timeoutMinutes":{"type":"integer"},"reason":{"type":"string","nullable":true}}},"examples":{"response":{"summary":"Session still active","value":{"expired":false,"remainingSeconds":1800,"timeoutMinutes":30,"reason":null}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalFormsFormIdTimeoutStatus"}},"/api/enrollment-portal/forms/{formId}/pdf":{"get":{"summary":"Get a presigned URL to the form PDF","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Presigned URL","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["url"],"properties":{"url":{"type":"string","format":"uri"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalFormsFormIdPdf"}},"/api/enrollment-portal/forms/{formId}/sign":{"post":{"summary":"Apply signature and finalize submission","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"required":["signatureDataUrl"],"properties":{"signatureDataUrl":{"type":"string","pattern":"^data:image/(png|jpeg);base64,"}}},"examples":{"request":{"summary":"Sign with drawn signature","value":{"signature":{"image":"data:image/png;base64,iVBOR...","method":"draw"},"signer":{"fullName":"John Doe"}}}}}}},"responses":{"200":{"description":"Signed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"formId":{"type":"string"},"signedAt":{"type":"string","format":"date-time"},"signedPdfS3Key":{"type":"string","nullable":true}}},"examples":{"response":{"summary":"Signed confirmation","value":{"success":true,"formId":"f_abc123","signedAt":"2025-01-01T00:00:00Z"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalFormsFormIdSign"}},"/api/enrollment-portal/forms/{formId}/save-progress":{"post":{"summary":"Partial save during multi-step form flow","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"step":{"type":"integer"},"data":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"saved":{"type":"boolean","enum":[true]},"formId":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalFormsFormIdSaveProgress"}},"/api/enrollment-portal/forms/{formId}/demographics":{"put":{"summary":"Update employee demographics on the form","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"dateOfBirth":{"type":"string","format":"date"},"ssn":{"type":"string","writeOnly":true},"address":{"type":"object","additionalProperties":true,"properties":{"line1":{"type":"string"},"line2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"zip":{"type":"string"}}},"dependents":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"responses":{"200":{"description":"Demographics updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"formId":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"putEnrollmentPortalFormsFormIdDemographics"}},"/api/enrollment-portal/forms/{formId}/attachments":{"get":{"summary":"List attachments owned by the form","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"formId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"attachments":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentAttachment"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalFormsFormIdAttachments"}},"/api/enrollment-portal/sessions/{sessionId}/attachments":{"post":{"summary":"Upload an attachment to the session","tags":["Election Portal: Employee"],"security":[{"magicSessionToken":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","additionalProperties":true,"required":["file"],"properties":{"file":{"type":"string","format":"binary"},"formId":{"type":"string","description":"Form to attach to"}}}}}},"responses":{"200":{"description":"Uploaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentAttachment"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"postEnrollmentPortalSessionsSessionIdAttachments"},"get":{"summary":"List all attachments for the session","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"properties":{"attachments":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentAttachment"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsSessionIdAttachments"}},"/api/enrollment-portal/sessions/{sessionId}/attachments/{attachmentId}":{"delete":{"summary":"Delete an attachment","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}},{"name":"attachmentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"deleteEnrollmentPortalSessionsSessionIdAttachmentsAttachmentId"}},"/api/enrollment-portal/sessions/{sessionId}/elections":{"get":{"summary":"Fetch all submitted elections for the session (admin view)","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Elections grouped by form","content":{"application/json":{"schema":{"type":"object","properties":{"elections":{"type":"array","items":{"type":"object"}}}},"examples":{"response":{"summary":"Election results","value":{"elections":[{"employeeName":"John Doe","formId":"f_001","electionType":"enrolled","electedPlanId":"plan_123","electedPlanName":"Regence HDHP 3000","tier":"employee","electedAt":"2025-01-01T00:00:00Z"},{"employeeName":"Jane Smith","formId":"f_002","electionType":"declined","declineReason":"Covered by spouse","electedAt":"2025-01-02T00:00:00Z"}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsSessionIdElections"}},"/api/enrollment-portal/sessions/{sessionId}/download":{"get":{"summary":"Download bundled artifacts (PDFs/CSV/attachments) as a zip","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Zip bundle","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsSessionIdDownload"}},"/api/enrollment-portal/sessions/{sessionId}/export":{"get":{"summary":"Export session in a specified format (CSV/JSON/PDF)","tags":["Election Portal: Admin"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["csv","json","pdf"]}}],"responses":{"200":{"description":"Export blob; Content-Type matches the requested format","content":{"application/json":{"schema":{"type":"object","properties":{"csv":{"type":"string","description":"CSV content"},"filename":{"type":"string"},"contentType":{"type":"string"}}},"examples":{"response":{"summary":"CSV export","value":{"csv":"Name,Status,Election\nJohn Doe,Enrolled,Regence HDHP 3000\n","filename":"enrollment-export-2025.csv","contentType":"text/csv"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/InternalServerError"}},"operationId":"getEnrollmentPortalSessionsSessionIdExport"}},"/api/cases/{id}/history":{"get":{"summary":"Get case version history","description":"Returns the saved version history for a case, newest first, for the history modal.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Case version history","content":{"application/json":{"schema":{"type":"object","required":["ok","versions"],"properties":{"ok":{"type":"boolean","example":true},"versions":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string"},"savedBy":{"type":"string","nullable":true},"employerName":{"type":"string","nullable":true},"policyPeriod":{"type":"string","nullable":true},"planCount":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true}}}}}},"example":{"ok":true,"versions":[{"id":"ver_123","savedBy":"user_123","employerName":"Acme Corporation","policyPeriod":"01/01/2026 - 12/31/2026","planCount":4,"createdAt":"2026-07-07T14:30:00.000Z"}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found or version history unavailable"},"500":{"description":"Failed to load case version history"}},"operationId":"getCasesByIdHistory"}},"/api/cases/{id}/history/{versionId}/changes":{"get":{"summary":"Get case version diff","description":"Returns the structured diff for a case version relative to its immediate predecessor. If the selected version is the first saved version or the source S3 object has expired, the response returns ok=true with changes=null and a reason.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"description":"Version identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Structured version diff or an empty-compare result","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true},"groups":{"type":"array","items":{"type":"object","additionalProperties":true}},"summary":{"type":"object","description":"Concise human-readable counts derived from the same structured diff.","properties":{"text":{"type":"string","example":"2 rates changed, 1 plan removed, proposal regenerated"},"fragments":{"type":"array","items":{"type":"string"}}},"additionalProperties":false},"changes":{"type":"array","nullable":true,"items":{"type":"object","additionalProperties":true}},"reason":{"type":"string","enum":["initial","expired"],"nullable":true}}},"examples":{"withChanges":{"value":{"ok":true,"groups":[{"label":"Medical Plans","changes":[{"field":"deductible","before":"$1,500 / $3,000","after":"$1,750 / $3,500"}]}],"summary":{"text":"1 rate changed","fragments":["1 rate changed"]}}},"initialVersion":{"value":{"ok":true,"changes":null,"reason":"initial"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case or version not found"},"500":{"description":"Failed to compute case version changes"}},"operationId":"getCasesByIdHistoryByVersionIdChanges"}},"/api/cases/{id}/restore/{versionId}":{"post":{"summary":"Restore a prior case version","description":"Restores a previous saved case version as the current case blob. The restore itself records a new version.","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"Case identifier","schema":{"type":"string"}},{"name":"versionId","in":"path","required":true,"description":"Version identifier to restore","schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"description":"Quoted row-version ETag of the current case.","schema":{"type":"string","example":"\"4\""}}],"responses":{"200":{"description":"Case version restored","content":{"application/json":{"schema":{"type":"object","required":["ok","restored"],"properties":{"ok":{"type":"boolean","example":true},"restored":{"type":"boolean","example":true},"rowVersion":{"type":"integer","format":"int64","minimum":1}}},"example":{"ok":true,"restored":true,"rowVersion":5}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case or version not found, or version content has expired"},"412":{"description":"The case row version is stale"},"428":{"description":"If-Match is required"},"500":{"description":"Failed to restore case version"}},"operationId":"postCasesByIdRestoreByVersionId"}},"/api/v1/portal/logo/{user}/{file}":{"get":{"summary":"Fetch uploaded portal logo","description":"Public, non-expiring passthrough that streams an uploaded Employee Benefit Center logo from S3. Used by baked portal HTML so it does not rely on presigned URLs.","tags":["Election Portal: Employee"],"security":[],"parameters":[{"name":"user","in":"path","required":true,"description":"Slugified user identifier segment","schema":{"type":"string"}},{"name":"file","in":"path","required":true,"description":"Opaque uploaded logo file name","schema":{"type":"string"}}],"responses":{"200":{"description":"Logo binary","headers":{"Cache-Control":{"description":"Immutable cache policy for the uploaded logo","schema":{"type":"string"}},"Content-Security-Policy":{"description":"Locked-down CSP for direct navigation to uploaded SVGs","schema":{"type":"string"}},"X-Content-Type-Options":{"description":"nosniff header","schema":{"type":"string"}}},"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/svg+xml":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid logo key"},"404":{"description":"Logo not found"},"500":{"description":"Failed to fetch logo"}},"operationId":"getPortalLogoByUserByFile"}},"/api/v1/recent-activity":{"get":{"summary":"Get recent document and share activity","description":"Returns recent documents and recent shared reports for the authenticated user. Used by the welcome-screen activity rail.","tags":["Analytics"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"description":"Maximum items to return per activity section","schema":{"type":"integer","minimum":1,"maximum":20,"default":5}}],"responses":{"200":{"description":"Recent activity payload","content":{"application/json":{"schema":{"type":"object","required":["documents","shares","windowDays"],"properties":{"documents":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string"},"filename":{"type":"string"},"caseId":{"type":"string","nullable":true},"employerName":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true}}}},"shares":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"reportId":{"type":"string"},"caseId":{"type":"string","nullable":true},"shareUrl":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true}}}},"windowDays":{"type":"integer","example":7}}},"example":{"documents":[{"id":"doc_123","filename":"Acme Renewal Packet.pdf","caseId":"case_123","employerName":"Acme Corporation","createdAt":"2026-07-06T18:24:00.000Z"}],"shares":[{"reportId":"rep_123","caseId":"case_123","shareUrl":"https://app.trybart.com/r/rep_123","createdAt":"2026-07-05T15:02:00.000Z"}],"windowDays":7}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Failed to load recent activity"},"503":{"description":"Database unavailable"}},"operationId":"getRecentActivity"}},"/api/v1/health":{"get":{"operationId":"getApiV1Health","summary":"Check API health","description":"Returns the health and current timestamp of the v1 API router.","tags":["System"],"responses":{"200":{"description":"API is healthy","content":{"application/json":{"schema":{"type":"object","required":["ok","status","ts"],"properties":{"ok":{"type":"boolean","example":true},"status":{"type":"string","example":"healthy"},"ts":{"type":"string","format":"date-time"}}}}}}}}},"/api/v1/engines":{"get":{"operationId":"listApiV1ParseEngines","summary":"List parsing engines","description":"Reports availability of the configured document parsing engines.","tags":["Parse"],"responses":{"200":{"description":"Engine availability","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseEnginesResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/v1/parse":{"post":{"operationId":"parseBase64DocumentV1","summary":"Parse a base64 document","description":"Parses a base64-encoded PDF or image with the legacy v1 benefit parser.","tags":["Parse"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseBase64Request"}}}},"responses":{"200":{"description":"Parsed document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseV1Response"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/v1/parse/url":{"post":{"operationId":"parseRemoteDocumentV1","summary":"Parse a remote document (removed)","description":"Removed. Always responds 410 Gone. Upload the file to POST /api/v1/parse instead.","deprecated":true,"tags":["Parse"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseRemoteRequest"}}}},"responses":{"200":{"description":"Parsed remote document","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseV1Response"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"URL is blocked"},"410":{"description":"Endpoint removed"},"413":{"description":"Remote document exceeds the size limit"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/custom-oauth/connections":{"get":{"operationId":"listCustomOAuthConnections","summary":"List custom OAuth connections","description":"Returns non-secret connection metadata for the current organization.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Connection metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthConnectionsResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/external-apps/oauth/authorize":{"get":{"operationId":"getExternalAppOAuthConsent","summary":"Get OAuth consent details","description":"Validates an OAuth authorization request and returns signed consent details for the authenticated user. Browser requests may receive an HTML consent page.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","format":"uri"}},{"name":"response_type","in":"query","required":true,"schema":{"type":"string","enum":["code"]}},{"name":"scope","in":"query","required":false,"schema":{"type":"string"}},{"name":"state","in":"query","schema":{"type":"string"}},{"name":"code_challenge","in":"query","schema":{"type":"string"}},{"name":"code_challenge_method","in":"query","schema":{"type":"string","enum":["plain","S256"]}}],"responses":{"200":{"description":"Validated consent request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthConsentResponse"}},"text/html":{"schema":{"type":"string"}}}},"302":{"description":"Redirect an unauthenticated browser request to the application login flow"},"400":{"description":"Invalid authorization request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"post":{"operationId":"submitExternalAppOAuthConsent","summary":"Submit OAuth consent","description":"Approves or denies a signed, authenticated OAuth authorization request.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["consent_token","decision"],"properties":{"consent_token":{"type":"string"},"decision":{"type":"string","enum":["approve","deny"]}}}}}},"responses":{"200":{"description":"Consent decision returned to an API client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthConsentDecisionResponse"}}}},"302":{"description":"Redirect to the registered client callback","headers":{"Location":{"description":"Registered callback URL with a code or access_denied error","schema":{"type":"string","format":"uri"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/v1/parse/unified/jobs/{jobId}/cancel":{"post":{"operationId":"cancelUnifiedParseJob","summary":"Cancel a queued unified parse job","description":"Cancels a queued async unified-parse job owned by the authenticated caller. Processing jobs return 409.","tags":["Parse"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"description":"Async parse job identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Job cancelled","content":{"application/json":{"schema":{"type":"object","required":["ok","cancelled","jobId","status"],"properties":{"ok":{"type":"boolean"},"cancelled":{"type":"boolean"},"jobId":{"type":"string"},"status":{"type":"string","enum":["cancelled"]}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Job not found or inaccessible"},"409":{"description":"Job is already processing or complete"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/sbc-links/create":{"post":{"operationId":"createSbcLink","summary":"Create an SBC short link","description":"Creates a tracked short link to an existing S3 document.","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkCreateRequest"}}}},"responses":{"200":{"description":"Short link created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkCreateResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"409":{"description":"Custom slug already exists"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"503":{"description":"Link service unavailable"}}}},"/api/sbc-links/carrier-docs/code":{"get":{"operationId":"mintCarrierDocsCode","summary":"Mint a carrier documents landing code","description":"Mints the signed, expiring code that the public carrier-docs landing page (GET /carrier-docs/{code}) verifies. The resulting URL is a durable public capability — anyone holding it can list the case's share-tokened documents for that carrier without logging in — so the caller must hold at least read access to the case.","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"query","required":true,"schema":{"type":"string"}},{"name":"carrierKey","in":"query","required":true,"description":"Carrier identifier; lower-cased server-side.","schema":{"type":"string"}}],"responses":{"200":{"description":"Signed code minted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"code":{"type":"string","description":"Signed code for the public landing page URL."},"exp":{"type":"integer","format":"int64","description":"Expiry as a Unix epoch timestamp in milliseconds."}}}}}},"400":{"description":"caseId and carrierKey are required"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller lacks read access to the case"},"500":{"description":"Internal server error"},"503":{"description":"Link service unavailable"}}}},"/api/sbc-links/list":{"get":{"operationId":"listSbcLinks","summary":"List SBC links","description":"Lists links owned by the caller or organization, optionally filtered by case, plan, or kind.","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"caseId","in":"query","schema":{"type":"string"}},{"name":"planId","in":"query","schema":{"type":"string"}},{"name":"kind","in":"query","schema":{"type":"string","enum":["sbc","sharefile","portal","guide"]}}],"responses":{"200":{"description":"Matching links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkListResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/sbc-links/signatures":{"get":{"operationId":"listSbcSignatureLinks","summary":"List signature-enabled SBC links","description":"Returns signature-enabled links visible to the caller for audit review.","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Signature-enabled links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcSignatureLinkListResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"503":{"description":"Link service unavailable"}}}},"/api/sbc-links/{id}":{"get":{"operationId":"getSbcLink","summary":"Get an SBC link","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"SBC link identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Link details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller cannot access this link"},"404":{"description":"Link not found"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"delete":{"operationId":"deleteSbcLink","summary":"Revoke an SBC link","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"SBC link identifier","schema":{"type":"string"}}],"responses":{"200":{"description":"Link revoked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkDeleteResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller cannot access this link"},"404":{"description":"Link not found"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"patch":{"operationId":"updateSbcLink","summary":"Update an SBC link","description":"Updates the link expiration using an absolute timestamp or extension in days.","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"SBC link identifier","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkUpdateRequest"}}}},"responses":{"200":{"description":"Updated link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller cannot access this link"},"404":{"description":"Link not found"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/sbc-links/{id}/analytics":{"get":{"operationId":"getSbcLinkAnalytics","summary":"Get SBC link analytics","tags":["SBC Links"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"description":"SBC link identifier","schema":{"type":"string"}},{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"default":30}}],"responses":{"200":{"description":"Link analytics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SbcLinkAnalyticsResponse"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller cannot access this link"},"404":{"description":"Link not found"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/custom-oauth/providers/{providerId}":{"delete":{"operationId":"deleteCustomOauthProvidersProviderId","summary":"Delete Providers","description":"Delete Providers in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Provider deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthDeleteResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"providerId","in":"path","required":true,"schema":{"type":"string"}}]},"get":{"operationId":"getCustomOauthProvidersProviderId","summary":"Get Providers","description":"Get Providers in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Custom OAuth provider","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProviderResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"providerId","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"operationId":"putCustomOauthProvidersProviderId","summary":"Replace Providers","description":"Replace Providers in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Provider updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProviderResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"providerId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProviderUpdate"}}}}}},"/api/enrollment-batch/jobs/{jobId}":{"delete":{"operationId":"deleteEnrollmentBatchJobsJobId","summary":"Delete Jobs","description":"Delete Jobs in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Enrollment batch job deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchDeleteResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}]},"get":{"operationId":"getEnrollmentBatchJobsJobId","summary":"Get Jobs","description":"Get Jobs in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Enrollment batch job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchJobResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/external-apps/oauth/apps/{appId}":{"delete":{"operationId":"deleteExternalAppsOauthAppsAppId","summary":"Delete Oauth Apps","description":"Delete Oauth Apps in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppDeleteResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}]},"get":{"operationId":"getExternalAppsOauthAppsAppId","summary":"Get Oauth Apps","description":"Get Oauth Apps in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"operationId":"putExternalAppsOauthAppsAppId","summary":"Replace Oauth Apps","description":"Replace Oauth Apps in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppUpdateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppUpdateRequest"}}}}}},"/api/v1/assistant-work/memory":{"get":{"operationId":"listAssistantMemory","summary":"List governed Assistant memory","description":"Lists visible, unexpired memory for the authenticated scope. Case-derived entries are excluded unless case context is explicitly enabled.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"contextEnabled","in":"query","required":false,"schema":{"type":"boolean","default":false}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}],"responses":{"200":{"description":"Visible governed memory entries","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"memory":{"type":"array","items":{"type":"object"}}}},"examples":{"response":{"summary":"Memory list","value":{"success":true,"memory":[{"id":"mem_001","key":"benefit_preference","value":{"preferredCarrier":"Regence"},"contextEnabled":true,"updatedAt":"2025-01-01T00:00:00Z"}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Memory listing failed"}}},"post":{"operationId":"createAssistantMemory","summary":"Create governed Assistant memory","description":"Creates a typed, explained memory entry. Case memory requires active case context and organization playbooks require owner or admin role.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["kind","key","valueType","value","source","explanation"],"properties":{"id":{"type":"string","maxLength":160},"kind":{"type":"string","enum":["user_preference","case_preference","organization_playbook","workflow_default"]},"key":{"type":"string","maxLength":120},"valueType":{"type":"string","enum":["string","number","boolean","string_list"]},"value":{},"source":{"type":"string","maxLength":160},"explanation":{"type":"string","maxLength":500},"caseId":{"type":"string","maxLength":128},"workflowId":{"type":"string","maxLength":160},"contextEnabled":{"type":"boolean"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"responses":{"201":{"description":"Memory entry created"},"400":{"description":"Memory type, value, source, or context is invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Case or organization role is unavailable"},"409":{"description":"Memory identifier already exists"},"500":{"description":"Memory creation failed"}}}},"/api/v1/assistant-work/memory/{memoryId}":{"patch":{"operationId":"updateAssistantMemory","summary":"Update governed Assistant memory","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"memoryId","in":"path","required":true,"schema":{"type":"string","maxLength":160}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["expectedVersion"],"properties":{"expectedVersion":{"type":"integer","minimum":1},"value":{},"source":{"type":"string","maxLength":160},"explanation":{"type":"string","maxLength":500},"contextEnabled":{"type":"boolean"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Memory entry updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"memory":{"type":"object"}}}}}},"400":{"description":"Invalid memory update"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Memory entry is outside the authenticated scope"},"404":{"description":"Memory entry not found"},"409":{"description":"Memory changed on another device"},"500":{"description":"Memory update failed"}}},"delete":{"operationId":"deleteAssistantMemory","summary":"Delete governed Assistant memory","description":"Physically deletes the entry so it cannot enter future prompts or scheduled work.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"memoryId","in":"path","required":true,"schema":{"type":"string","maxLength":160}},{"name":"expectedVersion","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Memory entry deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"boolean"}}}}}},"400":{"description":"Expected version is required"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Memory entry is outside the authenticated scope"},"404":{"description":"Memory entry not found"},"409":{"description":"Memory changed on another device"},"500":{"description":"Memory deletion failed"}}}},"/api/v1/assistant-work/work-items/{workItemId}/governance":{"get":{"operationId":"getAssistantWorkGovernance","summary":"Get Assistant Work collaboration and approval history","description":"Returns collaboration state and the append-only approval timeline after rechecking organization and case access.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"workItemId","in":"path","required":true,"schema":{"type":"string","maxLength":160}},{"name":"ownerUserId","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Scoped collaboration and approval history","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"governance":{"type":"array","items":{"type":"object"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Work item, organization, or case access is unavailable"},"404":{"description":"Work item not found"},"500":{"description":"Governance listing failed"}}}},"/api/v1/assistant-work/work-items/{workItemId}/collaborators":{"put":{"operationId":"upsertAssistantWorkCollaborator","summary":"Assign or share an Assistant Work item","description":"Adds an active organization member as assignee, watcher, or approver without changing case or action permissions.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"workItemId","in":"path","required":true,"schema":{"type":"string","maxLength":160}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["role","memberRef"],"properties":{"ownerUserId":{"type":"string","maxLength":200},"role":{"type":"string","enum":["assignee","watcher","approver"]},"memberRef":{"type":"string","maxLength":200},"note":{"type":"string","maxLength":300}}}}}},"responses":{"200":{"description":"Collaboration entry active","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"collaborator":{"type":"object"}}}}}},"400":{"description":"Invalid collaboration request"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Manager, member, or case permission check failed"},"404":{"description":"Work item not found"},"500":{"description":"Collaboration update failed"}}}},"/api/v1/assistant-work/work-items/{workItemId}/collaborators/{memberUserId}/{role}":{"delete":{"operationId":"removeAssistantWorkCollaborator","summary":"Remove Assistant Work collaboration","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"workItemId","in":"path","required":true,"schema":{"type":"string","maxLength":160}},{"name":"memberUserId","in":"path","required":true,"schema":{"type":"string","maxLength":200}},{"name":"role","in":"path","required":true,"schema":{"type":"string","enum":["assignee","watcher","approver"]}},{"name":"ownerUserId","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"expectedVersion","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Collaboration entry removed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"collaborator":{"type":"object"}}}}}},"400":{"description":"Invalid role or expected version"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Manager permission check failed"},"404":{"description":"Collaboration entry not found"},"409":{"description":"Collaboration changed on another device"},"500":{"description":"Collaboration removal failed"}}}},"/api/v1/assistant-work/work-items/{workItemId}/approvals":{"post":{"operationId":"recordAssistantWorkApproval","summary":"Append an Assistant Work approval event","description":"Records a deduplicated approval decision. Approval does not execute an intent; execution remains live and permission-checked.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"workItemId","in":"path","required":true,"schema":{"type":"string","maxLength":160}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["eventKey","decision"],"properties":{"ownerUserId":{"type":"string","maxLength":200},"eventKey":{"type":"string","maxLength":200},"decision":{"type":"string","enum":["requested","approved","rejected","changes_requested","cancelled"]},"runId":{"type":"string","maxLength":160},"approvalRole":{"type":"string","maxLength":80},"comment":{"type":"string","maxLength":1000}}}}}},"responses":{"200":{"description":"Idempotent replay of an existing approval event","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string"},"replayed":{"type":"boolean"}}}}}},"201":{"description":"Approval event appended"},"400":{"description":"Invalid approval decision"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Manager or approver assignment is required"},"404":{"description":"Work item not found"},"409":{"description":"Event key already belongs to another decision"},"500":{"description":"Approval event failed"}}}},"/api/v1/assistant-work/schedules":{"get":{"operationId":"listAssistantSchedules","summary":"List Assistant monitoring schedules","description":"Lists monitoring schedules scoped to the authenticated user and current organization.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","paused"]}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}],"responses":{"200":{"description":"Scoped Assistant schedules","content":{"application/json":{"schema":{"type":"object","required":["success","schedules"],"properties":{"success":{"type":"boolean","enum":[true]},"schedules":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"examples":{"response":{"summary":"Schedule list","value":{"success":true,"schedules":[{"id":"sch_001","name":"Weekly Renewal Check","status":"active","cronExpression":"0 0 * * 1","producer":"schedule","updatedAt":"2025-01-01T00:00:00Z"}]}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Schedule listing failed"}}},"post":{"operationId":"createAssistantSchedule","summary":"Create an Assistant monitoring schedule","description":"Creates an allowlisted read-only monitor. Recommendations requiring writes are returned as waiting work for live approval.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["kind","caseId"],"properties":{"id":{"type":"string","maxLength":160},"kind":{"type":"string","enum":["proposal_readiness","renewal_window","missing_rates","missing_documents","significant_case_change","analytical_refresh"]},"caseId":{"type":"string","maxLength":128},"label":{"type":"string","maxLength":160},"intervalMinutes":{"type":"integer","minimum":15,"maximum":129600},"thresholdDays":{"type":"integer","minimum":1,"maximum":365},"notificationsEnabled":{"type":"boolean"},"nextRunAt":{"type":"string","format":"date-time"}}}}}},"responses":{"201":{"description":"Schedule created","content":{"application/json":{"schema":{"type":"object","required":["success","schedule"],"properties":{"success":{"type":"boolean","enum":[true]},"schedule":{"type":"object","additionalProperties":true}}}}}},"400":{"description":"Schedule kind, cadence, or case is invalid"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Case is outside the authenticated scope"},"500":{"description":"Schedule creation failed"}}}},"/api/v1/assistant-work/schedules/{scheduleId}":{"patch":{"operationId":"updateAssistantSchedule","summary":"Edit, pause, or resume an Assistant schedule","description":"Updates a scoped schedule using an optimistic expected version.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"scheduleId","in":"path","required":true,"schema":{"type":"string","maxLength":160}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["expectedVersion"],"properties":{"expectedVersion":{"type":"integer","minimum":1},"status":{"type":"string","enum":["active","paused"]},"kind":{"type":"string"},"caseId":{"type":"string","maxLength":128},"intervalMinutes":{"type":"integer","minimum":15,"maximum":129600},"thresholdDays":{"type":"integer","minimum":1,"maximum":365},"notificationsEnabled":{"type":"boolean"},"nextRunAt":{"type":"string","format":"date-time"}}}}}},"responses":{"200":{"description":"Schedule updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"schedule":{"type":"object"}}}}}},"400":{"description":"Invalid schedule update"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Case is outside the authenticated scope"},"404":{"description":"Schedule not found"},"409":{"description":"Schedule version changed on another device"},"500":{"description":"Schedule update failed"}}},"delete":{"operationId":"deleteAssistantSchedule","summary":"Delete an Assistant schedule","description":"Deletes a scoped schedule only when the expected version still matches.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"scheduleId","in":"path","required":true,"schema":{"type":"string","maxLength":160}},{"name":"expectedVersion","in":"query","required":true,"schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Schedule deleted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"deleted":{"type":"boolean"}}}}}},"400":{"description":"Expected version is required"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Schedule not found"},"409":{"description":"Schedule version changed on another device"},"500":{"description":"Schedule deletion failed"}}}},"/api/v1/assistant-work/sync":{"post":{"operationId":"syncAssistantWork","summary":"Shadow-sync Assistant Work","description":"Persists bounded local-first Assistant Work projections for the authenticated user and current organization. Replayed mutation IDs and run-event keys are idempotent.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["mutationId","deviceId","records"],"properties":{"mutationId":{"type":"string","maxLength":200},"deviceId":{"type":"string","maxLength":160},"records":{"type":"object","additionalProperties":false,"properties":{"items":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":true}},"runs":{"type":"array","maxItems":200,"items":{"type":"object","additionalProperties":true,"properties":{"continuation":{"$ref":"#/components/schemas/AssistantFileWorkContinuation"},"commandContinuation":{"$ref":"#/components/schemas/AssistantCommandContinuation"}}}},"receipts":{"type":"array","maxItems":300,"items":{"type":"object","additionalProperties":true}}}}}}}}},"responses":{"200":{"description":"Shadow write accepted and reconciled","content":{"application/json":{"schema":{"type":"object","required":["success","mode","mutationId","replayed","outcomes"],"properties":{"success":{"type":"boolean","enum":[true]},"mode":{"type":"string","enum":["shadow_write"]},"mutationId":{"type":"string"},"replayed":{"type":"boolean"},"outcomes":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}}},"400":{"description":"Invalid or oversized Assistant Work projection"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Assistant Work shadow sync failed"},"503":{"description":"Assistant Work shadow writes are disabled"}}}},"/api/v1/assistant-work/events":{"post":{"operationId":"recordAssistantWorkLifecycleEvent","summary":"Record an Assistant Work lifecycle metric","description":"Records an authenticated, privacy-safe Assistant Work lifecycle event using a strict event and dimension allowlist. Raw prompts, case data, user content, and record identifiers are not accepted as metric dimensions.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event"],"properties":{"event":{"type":"string","enum":["goal_created","goal_accepted","goal_unsupported","run_started","approval_requested","approval_decided","step_committed","verification_passed","verification_failed","run_recovered","rollback_used","work_snoozed","work_dismissed","work_reopened","schedule_triggered"]},"dimensions":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string"},"source":{"type":"string"},"producer":{"type":"string","enum":["assistant","proactive","qcc","proposal","contribution","workflow","schedule","manual","unknown"]},"route":{"type":"string","enum":["deterministic","default","analytical","workflow","schedule","unknown"]},"modelTier":{"type":"string","enum":["none","default","analytical","unknown"]},"outcome":{"type":"string","enum":["success","failure","wrong_action","cancelled","unsupported","reopened","unknown"]},"status":{"type":"string"},"verification":{"type":"string"},"decision":{"type":"string"},"shared":{"type":"boolean"},"role":{"type":"string"}}},"durationMs":{"type":"integer","minimum":0,"maximum":31536000000}},"additionalProperties":false},"examples":{"request":{"summary":"Lifecycle event","value":{"event":"goal_created","dimensions":{"kind":"goal","source":"assistant","status":"open","route":"default","modelTier":"none","outcome":"unknown","shared":"false"},"durationMs":150}}}}}},"responses":{"200":{"description":"Lifecycle metric accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"event":{"type":"string"}}},"examples":{"response":{"summary":"Event accepted","value":{"success":true,"event":"goal_created"}}}}}},"400":{"description":"Unsupported event or invalid dimensions"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Use a concrete artifact workflow"}}}},"/api/v1/assistant-work/state":{"get":{"operationId":"getAssistantWorkState","summary":"Get cloud Assistant Work state","description":"Returns authenticated user and organization scoped Assistant Work state only when cloud reads are explicitly enabled for the rollout cohort.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":300,"default":200}}],"responses":{"200":{"description":"Cloud-backed Assistant Work state","content":{"application/json":{"schema":{"type":"object","required":["success","mode","items","runs","receipts"],"properties":{"success":{"type":"boolean","enum":[true]},"mode":{"type":"string","enum":["cloud_read"]},"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"runs":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"continuation":{"$ref":"#/components/schemas/AssistantFileWorkContinuation"},"commandContinuation":{"$ref":"#/components/schemas/AssistantCommandContinuation"}}}},"receipts":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"examples":{"response":{"summary":"Work state","value":{"success":true,"mode":"cloud_read","items":[{"id":"wi_001","kind":"goal","status":"in_progress","title":"Process renewal for Acme Corp","producer":"assistant","updatedAt":"2025-01-01T00:00:00Z"}]}}}}}},"400":{"description":"Invalid Assistant Work query"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Cloud reads are disabled for this rollout"},"500":{"description":"Assistant Work cloud read failed"}}}},"/api/v1/chat/messages":{"delete":{"operationId":"deleteChatMessages","summary":"Delete Chat Messages","description":"Delete Chat Messages in the Planlined chat workflow.","tags":["Chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Case chat messages cleared","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatDeleteMessagesResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Failed to clear chat messages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatClearMessagesRequest"}}}}},"get":{"operationId":"getChatMessages","summary":"List Chat Messages","description":"List Chat Messages in the Planlined chat workflow.","tags":["Chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Recent chat messages in chronological order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessagesResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Failed to hydrate chat messages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}}},"parameters":[{"name":"caseId","in":"query","required":false,"description":"Case-scoped conversation key.","schema":{"type":"string","maxLength":128,"default":"default"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of recent messages to hydrate.","schema":{"type":"integer","minimum":1,"maximum":500,"default":50}}]},"post":{"operationId":"postChatMessages","summary":"Create or run Chat Messages","description":"Create or run Chat Messages in the Planlined chat workflow.","tags":["Chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Chat messages persisted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessagesPostResponse"}}}},"400":{"description":"No valid messages supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Failed to persist chat messages","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatMessagesRequest"}}}}}},"/api/v1/documents/{documentId}":{"delete":{"operationId":"deleteDocumentsDocumentId","summary":"Delete Documents","description":"Delete Documents in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Document deleted","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/documents/{documentId}/share":{"delete":{"operationId":"deleteDocumentsDocumentIdShare","summary":"Delete Documents Share","description":"Delete Documents Share in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Share revoked","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}]},"post":{"operationId":"postDocumentsDocumentIdShare","summary":"Create or run Documents Share","description":"Create or run Documents Share in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Share token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentShareResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"urlPrefix":{"type":"string"}}}}}}}},"/api/v1/documents/folders/{folderId}":{"delete":{"operationId":"deleteDocumentsFoldersFolderId","summary":"Delete Documents Folders","description":"Delete Documents Folders in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Folder deleted","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"folderId","in":"path","required":true,"schema":{"type":"string"}}]},"patch":{"operationId":"patchDocumentsFoldersFolderId","summary":"Update Documents Folders","description":"Update Documents Folders in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Folder updated","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"folderId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentFolderUpdateRequest"}}}}}},"/api/cms/county/{zip}":{"get":{"operationId":"getCmsCountyZip","summary":"Get County","description":"Get County in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"zip","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/cms/ichra-benchmark":{"get":{"operationId":"getCmsIchraBenchmark","summary":"List Ichra Benchmark","description":"List Ichra Benchmark in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"zip","in":"query","required":true,"schema":{"type":"string","minLength":5,"maxLength":10}},{"name":"age","in":"query","required":true,"schema":{"type":"integer","minimum":18,"maximum":120}},{"name":"dependentAges","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated dependent ages."},{"name":"year","in":"query","required":false,"schema":{"type":"integer","minimum":2020}},{"name":"income","in":"query","required":false,"schema":{"type":"number","minimum":0}},{"name":"uses_tobacco","in":"query","required":false,"schema":{"type":"boolean","default":false}}]}},"/api/cms/metal-levels":{"get":{"operationId":"getCmsMetalLevels","summary":"List Metal Levels","description":"List Metal Levels in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"ACA metal-level reference data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsMetalLevelsResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}}}},"/api/cms/plans/{planId}":{"get":{"operationId":"getCmsPlansPlanId","summary":"Get Plans","description":"Get Plans in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"planId","in":"path","required":true,"schema":{"type":"string"}},{"name":"countyfips","in":"query","required":true,"schema":{"type":"string"},"description":"County FIPS code."},{"name":"year","in":"query","required":false,"schema":{"type":"integer","minimum":2020}}]}},"/api/cms/rate-areas/{state}/{zip}":{"get":{"operationId":"getCmsRateAreasStateZip","summary":"Get Rate Areas","description":"Get Rate Areas in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"state","in":"path","required":true,"schema":{"type":"string"}},{"name":"zip","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/cms/slcsp/{zip}/{age}":{"get":{"operationId":"getCmsSlcspZipAge","summary":"Get Slcsp","description":"Get Slcsp in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"zip","in":"path","required":true,"schema":{"type":"string"}},{"name":"age","in":"path","required":true,"schema":{"type":"string"}},{"name":"year","in":"query","required":false,"schema":{"type":"integer","minimum":2020}},{"name":"income","in":"query","required":false,"schema":{"type":"number","minimum":0}},{"name":"uses_tobacco","in":"query","required":false,"schema":{"type":"boolean","default":false}},{"name":"fips","in":"query","required":false,"schema":{"type":"string"},"description":"County FIPS override."},{"name":"countyfips","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `fips`."}]}},"/api/cms/status":{"get":{"operationId":"getCmsStatus","summary":"List Status","description":"List Status in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS service status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsStatusResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}}}},"/api/custom-oauth/authorize/{authorizeId}":{"get":{"operationId":"getCustomOauthAuthorizeAuthorizeId","summary":"Start a custom OAuth authorization","description":"Start a custom OAuth authorization in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"302":{"description":"Redirect to the provider or back to the application.","headers":{"Location":{"description":"OAuth provider or application redirect URL.","schema":{"type":"string","format":"uri"}}}}},"parameters":[{"name":"authorizeId","in":"path","required":true,"schema":{"type":"string"}},{"name":"returnUrl","in":"query","required":false,"schema":{"type":"string"},"description":"Application URL to return to after authorization."}]}},"/api/custom-oauth/callback/{callbackId}":{"get":{"operationId":"getCustomOauthCallbackCallbackId","summary":"Complete a custom OAuth authorization","description":"Complete a custom OAuth authorization in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[],"responses":{"302":{"description":"Redirect to the provider or back to the application.","headers":{"Location":{"description":"OAuth provider or application redirect URL.","schema":{"type":"string","format":"uri"}}}}},"parameters":[{"name":"callbackId","in":"path","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","required":false,"schema":{"type":"string"}},{"name":"state","in":"query","required":false,"schema":{"type":"string"}},{"name":"error","in":"query","required":false,"schema":{"type":"string"}},{"name":"error_description","in":"query","required":false,"schema":{"type":"string"}}]}},"/api/custom-oauth/providers":{"get":{"operationId":"getCustomOauthProviders","summary":"List Providers","description":"List Providers in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Custom OAuth providers","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProvidersResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"post":{"operationId":"postCustomOauthProviders","summary":"Create or run Providers","description":"Create or run Providers in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Provider created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProviderResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthProviderCreate"}}}}}},"/api/custom-oauth/url/{urlId}":{"get":{"operationId":"getCustomOauthUrlUrlId","summary":"Get Url","description":"Get Url in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Authorization URLs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthAuthorizationUrlResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"urlId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/element-visibility/categories":{"get":{"operationId":"getElementVisibilityCategories","summary":"List Categories","description":"List Categories in the Planlined element visibility workflow.","tags":["Element Visibility"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/element-visibility/my-rules":{"get":{"operationId":"getElementVisibilityMyRules","summary":"List My Rules","description":"List My Rules in the Planlined element visibility workflow.","tags":["Element Visibility"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/enrollment-batch/jobs":{"get":{"operationId":"getEnrollmentBatchJobs","summary":"List Jobs","description":"List Jobs in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Most recent enrollment batch jobs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchJobsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"post":{"operationId":"postEnrollmentBatchJobs","summary":"Create or run Jobs","description":"Create or run Jobs in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]}],"responses":{"202":{"description":"Batch job accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchJobCreatedResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchUploadRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchJsonRequest"}}}}}},"/api/enrollment-batch/jobs/{jobId}/download":{"get":{"operationId":"getEnrollmentBatchJobsJobIdDownload","summary":"Get Jobs Download","description":"Get Jobs Download in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Binary response","content":{"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/enrollment-mappings":{"get":{"operationId":"getEnrollmentMappings","summary":"List resource","description":"List resource in the Planlined enrollment mappings workflow.","tags":["Enrollment Mappings"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Saved mappings for the PDF hash","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentMappingsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"pdfHash","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":64},"description":"PDF hash"}]},"post":{"operationId":"postEnrollmentMappings","summary":"Create or run resource","description":"Create or run resource in the Planlined enrollment mappings workflow.","tags":["Enrollment Mappings"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mapping saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentMappingSavedResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentMappingCreateRequest"}}}}}},"/api/error-codes/category/{categoryId}":{"get":{"operationId":"getErrorCodesCategoryCategoryId","summary":"Get Category","description":"Get Category in the Planlined error codes workflow.","tags":["Error Codes"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"categoryId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/exports/{exportsId}":{"get":{"operationId":"getExportsExportsId","summary":"Get resource","description":"Get resource in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Export job status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportJobResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"exportsId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/exports/{exportsId}/download":{"get":{"operationId":"getExportsExportsIdDownload","summary":"Get Download","description":"Get Download in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Export file or redirect to its download URL","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"exportsId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/exports/excel-available":{"get":{"operationId":"getExportsExcelAvailable","summary":"List Excel Available","description":"List Excel Available in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Server-side generator availability","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportAvailabilityResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/exports/pdf-available":{"get":{"operationId":"getExportsPdfAvailable","summary":"List Pdf Available","description":"List Pdf Available in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Server-side generator availability","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportAvailabilityResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/exports/proxy-asset":{"get":{"operationId":"getExportsProxyAsset","summary":"List Proxy Asset","description":"List Proxy Asset in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Proxied asset","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"url","in":"query","required":true,"schema":{"type":"string","format":"uri"}}]}},"/api/external-apps/api-keys":{"get":{"operationId":"getExternalAppsApiKeys","summary":"List Api Keys","description":"List Api Keys in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeysResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"post":{"operationId":"postExternalAppsApiKeys","summary":"Create or run Api Keys","description":"Create or run Api Keys in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyCreateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyCreateRequest"}}}}}},"/api/external-apps/oauth/apps":{"get":{"operationId":"getExternalAppsOauthApps","summary":"List Oauth Apps","description":"List Oauth Apps in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"post":{"operationId":"postExternalAppsOauthApps","summary":"Create or run Oauth Apps","description":"Create or run Oauth Apps in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppCreateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthAppCreateRequest"}}}}}},"/api/external-apps/oauth/scopes":{"get":{"operationId":"getExternalAppsOauthScopes","summary":"List Oauth Scopes","description":"List Oauth Scopes in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthScopesResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/jobs/meta/stats":{"get":{"operationId":"getJobsMetaStats","summary":"List Meta Stats","description":"List Meta Stats in the Planlined jobs workflow.","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/jobs/meta/types":{"get":{"operationId":"getJobsMetaTypes","summary":"List Meta Types","description":"List Meta Types in the Planlined jobs workflow.","tags":["Jobs"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/jobs":{"get":{"summary":"List asynchronous jobs for a partner integration","description":"Returns jobs visible to the authenticated user or organization using tenant-bound opaque cursor pagination. The legacy /api/jobs offset response remains available for compatibility.","operationId":"listPartnerJobsV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"status","in":"query","description":"One status or a comma-separated set of statuses.","schema":{"type":"string"}},{"name":"type","in":"query","description":"Exact asynchronous job type.","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum items per page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor returned in pageInfo.nextCursor.","schema":{"type":"string"}},{"name":"offset","in":"query","deprecated":true,"description":"Compatibility offset. Do not combine with cursor.","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Cursor-paginated asynchronous jobs.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobListResponse"}}}},"400":{"description":"Invalid cursor or conflicting pagination modes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/jobs/{id}":{"get":{"summary":"Get asynchronous job status","description":"Returns a job visible to the authenticated user or organization.","operationId":"getPartnerJobV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Asynchronous job status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobDetailResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}},"delete":{"summary":"Cancel a queued asynchronous job","description":"Cancels a queued job visible to the authenticated user or organization.","operationId":"cancelPartnerJobV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job cancellation accepted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobCancelResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The job cannot be cancelled in its current state."},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/jobs/{id}/result":{"get":{"summary":"Get a completed asynchronous job result","description":"Returns the result for a completed job visible to the authenticated user or organization.","operationId":"getPartnerJobResultV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Completed job result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobResultResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"description":"The job is not complete."},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/jobs/meta/stats":{"get":{"summary":"Get asynchronous job statistics","description":"Returns job counts for the authenticated user or organization.","operationId":"getPartnerJobStatsV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1,"maximum":365,"default":7}}],"responses":{"200":{"description":"Job statistics.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/v1/jobs/meta/types":{"get":{"summary":"List supported asynchronous job types","description":"Returns the asynchronous job types exposed by Planlined.","operationId":"listPartnerJobTypesV1","x-api-lifecycle":"stable","tags":["Jobs"],"security":[],"responses":{"200":{"description":"Supported job types.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobTypesResponse"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}},"/api/market/adoption":{"get":{"operationId":"getMarketAdoption","summary":"List Adoption","description":"List Adoption in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/compare":{"get":{"operationId":"getMarketCompare","summary":"List Compare","description":"List Compare in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."},{"name":"singlePremium","in":"query","required":false,"schema":{"type":"number"}},{"name":"familyPremium","in":"query","required":false,"schema":{"type":"number"}},{"name":"singleDeductible","in":"query","required":false,"schema":{"type":"number"}},{"name":"familyDeductible","in":"query","required":false,"schema":{"type":"number"}},{"name":"employerContributionPct","in":"query","required":false,"schema":{"type":"number"}},{"name":"employerPct","in":"query","required":false,"schema":{"type":"number"}},{"name":"planName","in":"query","required":false,"schema":{"type":"string"}}]},"post":{"operationId":"postMarketCompare","summary":"Create or run Compare","description":"Create or run Compare in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Plan comparison","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketCompareRequest"}}}}}},"/api/market/contributions":{"get":{"operationId":"getMarketContributions","summary":"List Contributions","description":"List Contributions in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/deductibles":{"get":{"operationId":"getMarketDeductibles","summary":"List Deductibles","description":"List Deductibles in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/enrollment":{"get":{"operationId":"getMarketEnrollment","summary":"List Enrollment","description":"List Enrollment in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/location":{"get":{"operationId":"getMarketLocation","summary":"List Location","description":"List Location in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."}]}},"/api/market/mployer/benchmarks":{"get":{"operationId":"getMarketMployerBenchmarks","summary":"List Mployer Benchmarks","description":"List Mployer Benchmarks in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."},{"name":"ein","in":"query","required":false,"schema":{"type":"string"}},{"name":"employerId","in":"query","required":false,"schema":{"type":"string"}}]}},"/api/market/mployer/broker/{brokerId}":{"get":{"operationId":"getMarketMployerBrokerBrokerId","summary":"Get Mployer Broker","description":"Get Mployer Broker in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"brokerId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/brokers":{"get":{"operationId":"getMarketMployerBrokers","summary":"List Mployer Brokers","description":"List Mployer Brokers in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/mployer/capabilities":{"get":{"operationId":"getMarketMployerCapabilities","summary":"List Mployer Capabilities","description":"List Mployer Capabilities in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/market/mployer/carrier/{carrierId}":{"get":{"operationId":"getMarketMployerCarrierCarrierId","summary":"Get Mployer Carrier","description":"Get Mployer Carrier in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"carrierId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/contact/{contactId}":{"get":{"operationId":"getMarketMployerContactContactId","summary":"Get Mployer Contact","description":"Get Mployer Contact in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"contactId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/employer":{"get":{"operationId":"getMarketMployerEmployer","summary":"List Mployer Employer","description":"List Mployer Employer in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"ein","in":"query","required":false,"schema":{"type":"string"},"description":"Nine-digit employer identification number."},{"name":"id","in":"query","required":false,"schema":{"type":"string"},"description":"Mployer employer identifier."}]}},"/api/market/mployer/employer/{employerId}/alerts":{"get":{"operationId":"getMarketMployerEmployerEmployerIdAlerts","summary":"Get Mployer Employer Alerts","description":"Get Mployer Employer Alerts in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"employerId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/employer/{employerId}/filings":{"get":{"operationId":"getMarketMployerEmployerEmployerIdFilings","summary":"Get Mployer Employer Filings","description":"Get Mployer Employer Filings in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"employerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"years","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":3}}]}},"/api/market/mployer/employer/{employerId}/plans":{"get":{"operationId":"getMarketMployerEmployerEmployerIdPlans","summary":"Get Mployer Employer Plans","description":"Get Mployer Employer Plans in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"employerId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planType","in":"query","required":false,"schema":{"type":"string"}}]}},"/api/market/mployer/employer/{employerId}/summary":{"get":{"operationId":"getMarketMployerEmployerEmployerIdSummary","summary":"Get Mployer Employer Summary","description":"Get Mployer Employer Summary in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"employerId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/insights/history":{"get":{"operationId":"getMarketMployerInsightsHistory","summary":"List Mployer Insights History","description":"List Mployer Insights History in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"employerId","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}]}},"/api/market/mployer/peo/{peoId}":{"get":{"operationId":"getMarketMployerPeoPeoId","summary":"Get Mployer Peo","description":"Get Mployer Peo in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"peoId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/market/mployer/status":{"get":{"operationId":"getMarketMployerStatus","summary":"List Mployer Status","description":"List Mployer Status in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}}}},"/api/market/mployer/trends":{"get":{"operationId":"getMarketMployerTrends","summary":"List Mployer Trends","description":"List Mployer Trends in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/premium-trends":{"get":{"operationId":"getMarketPremiumTrends","summary":"List Premium Trends","description":"List Premium Trends in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/market/premiums":{"get":{"operationId":"getMarketPremiums","summary":"List Premiums","description":"List Premiums in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"parameters":[{"name":"city","in":"query","required":false,"schema":{"type":"string"},"description":"City name."},{"name":"state","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2},"description":"Two-letter state code."},{"name":"zipCode","in":"query","required":false,"schema":{"type":"string"},"description":"ZIP code; `zip` is also accepted."},{"name":"zip","in":"query","required":false,"schema":{"type":"string"},"description":"Alias for `zipCode`."},{"name":"industry","in":"query","required":false,"schema":{"type":"string"},"description":"Industry category."},{"name":"employeeCount","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Employer size."},{"name":"employees","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"size","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Alias for `employeeCount`."},{"name":"planType","in":"query","required":false,"schema":{"type":"string"},"description":"Plan type filter."}]}},"/api/organizations/{orgId}/branding":{"get":{"operationId":"getOrganizationsOrgIdBranding","summary":"Get Branding","description":"Get Branding in the Planlined organizations workflow.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Organization branding retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationBrandingResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"operationId":"putOrganizationsOrgIdBranding","summary":"Replace Branding","description":"Replace Branding in the Planlined organizations workflow.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Organization branding updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationBrandingResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationBrandingUpdateRequest"}}}}}},"/api/organizations/{orgId}/settings":{"get":{"operationId":"getOrganizationsOrgIdSettings","summary":"Get Settings","description":"Get Settings in the Planlined organizations workflow.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Organization settings retrieved with defaults applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationResolvedSettingsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"operationId":"putOrganizationsOrgIdSettings","summary":"Replace Settings","description":"Replace Settings in the Planlined organizations workflow.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Organization settings updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSettingsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationSettings"}}}}}},"/api/plan-library/bulk-reparse/preview-stream":{"get":{"operationId":"getPlanLibraryBulkReparsePreviewStream","summary":"List Bulk Reparse Preview Stream","description":"List Bulk Reparse Preview Stream in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Server-sent events: status, init, plan:start, plan:progress, plan:complete, complete, and error","content":{"text/event-stream":{"schema":{"type":"string","description":"SSE event stream whose complete event contains a BulkReparseReport."}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"carrier","in":"query","required":false,"schema":{"type":"string"},"description":"Carrier filter"},{"name":"benefitType","in":"query","required":false,"schema":{"type":"string"},"description":"Benefit-type filter"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1},"description":"Maximum plans to process"},{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization context"}]},"post":{"operationId":"postPlanLibraryBulkReparsePreviewStream","summary":"Create or run Bulk Reparse Preview Stream","description":"Create or run Bulk Reparse Preview Stream in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Server-sent events: status, init, plan:start, plan:progress, plan:complete, complete, and error","content":{"text/event-stream":{"schema":{"type":"string","description":"SSE event stream whose complete event contains a BulkReparseReport."}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseFilterRequest"}}}}}},"/api/plan-library/bulk-reparse/stats":{"get":{"operationId":"getPlanLibraryBulkReparseStats","summary":"List Bulk Reparse Stats","description":"List Bulk Reparse Stats in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Plan-library re-parse readiness statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseStatsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Organization context"}]}},"/api/share-files/download":{"get":{"operationId":"getShareFilesDownload","summary":"List Download","description":"List Download in the Planlined file sharing workflow.","tags":["File Sharing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Binary response","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/share-files/url":{"get":{"operationId":"getShareFilesUrl","summary":"List Url","description":"List Url in the Planlined file sharing workflow.","tags":["File Sharing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/signatures/{signatureId}":{"get":{"operationId":"getSignaturesSignatureId","summary":"Get resource","description":"Get resource in the Planlined signatures workflow.","tags":["Signatures"],"security":[],"responses":{"200":{"description":"Signature record retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureRecord"}}}},"404":{"description":"Signature record not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}},"500":{"description":"Failed to retrieve signature record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}}},"parameters":[{"name":"signatureId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/signatures/{signatureId}/image":{"get":{"operationId":"getSignaturesSignatureIdImage","summary":"Get Image","description":"Get Image in the Planlined signatures workflow.","tags":["Signatures"],"security":[],"responses":{"302":{"description":"Redirect to a five-minute presigned signature image URL","headers":{"Location":{"description":"Presigned signature image URL.","schema":{"type":"string","format":"uri"}}}},"404":{"description":"Signature image is unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}},"500":{"description":"Failed to retrieve signature image","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}}},"parameters":[{"name":"signatureId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/signatures/document/{documentId}":{"get":{"operationId":"getSignaturesDocumentDocumentId","summary":"Get Document","description":"Get Document in the Planlined signatures workflow.","tags":["Signatures"],"security":[],"responses":{"200":{"description":"Document signatures retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentSignaturesResponse"}}}},"500":{"description":"Failed to retrieve document signatures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":false,"description":"Optional document type filter.","schema":{"type":"string"}}]}},"/api/signatures/user/{userId}":{"get":{"operationId":"getSignaturesUserUserId","summary":"Get User","description":"Get User in the Planlined signatures workflow.","tags":["Signatures"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"User signatures retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSignaturesResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Cannot view another user’s signatures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}},"500":{"description":"Failed to retrieve user signatures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}}},"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/bedrock/jobs/{jobId}":{"get":{"operationId":"getBedrockJobsJobId","summary":"Get Bedrock Jobs","description":"Get Bedrock Jobs in the Planlined bedrock workflow.","tags":["Bedrock"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/bedrock/my-usage":{"get":{"operationId":"getBedrockMyUsage","summary":"List Bedrock My Usage","description":"List Bedrock My Usage in the Planlined bedrock workflow.","tags":["Bedrock"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/bedrock/usage-details":{"get":{"operationId":"getBedrockUsageDetails","summary":"List Bedrock Usage Details","description":"List Bedrock Usage Details in the Planlined bedrock workflow.","tags":["Bedrock"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/documents":{"get":{"operationId":"getDocuments","summary":"List Documents","description":"List Documents in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Documents","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentListResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"docClass","in":"query","schema":{"type":"string"}},{"name":"artifactKind","in":"query","description":"Filter by the exact server-recorded artifact kind. Internal composition histories also require includeInternalArtifacts=true.","schema":{"type":"string"}},{"name":"scope","in":"query","schema":{"type":"string","enum":["user","org"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"includeDeleted","in":"query","schema":{"type":"boolean"}},{"name":"deletedOnly","in":"query","schema":{"type":"boolean"}},{"name":"derivedCaseId","in":"query","schema":{"type":"string"}},{"name":"folderId","in":"query","schema":{"type":"string"}},{"name":"includeInternalArtifacts","in":"query","description":"Include feature-owned JSON snapshots that are hidden from general document lists.","schema":{"type":"boolean","default":false}}]},"post":{"operationId":"postDocuments","summary":"Create or run Documents","description":"Create or run Documents in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Document uploaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUploadResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","docClass"],"properties":{"file":{"type":"string","format":"binary"},"docClass":{"type":"string"},"scope":{"type":"string","enum":["user","org"],"default":"user"},"metadata":{"description":"Artifact metadata. Named composition revisions use artifactKind proposal-book-version or presentation-composition-revision, remain user-private, and require a schema-v2 JSON file with a 1-80 character revision name.","oneOf":[{"type":"string"},{"type":"object","additionalProperties":true}]},"versionedArtifact":{"type":"boolean","default":false,"description":"Create an immutable server-versioned artifact. Required for named report and presentation composition revisions."}}}}}}}},"/api/v1/documents/browse":{"get":{"operationId":"getDocumentsBrowse","summary":"Browse Documents","description":"One filtered, searched and sorted page (50 rows) across the caller's personal and organization documents, for the full-page document library.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"filter","in":"query","schema":{"type":"string","default":"all"},"description":"Library tab key."},{"name":"search","in":"query","schema":{"type":"string","maxLength":500}},{"name":"sortBy","in":"query","schema":{"type":"string","default":"createdAt"}},{"name":"sortDir","in":"query","schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"name":"namedOnly","in":"query","schema":{"type":"boolean"}},{"name":"dateFilter","in":"query","schema":{"type":"string"}},{"name":"expirationFilter","in":"query","schema":{"type":"string"}},{"name":"caseFilterLabel","in":"query","schema":{"type":"string","maxLength":300}},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1}}],"responses":{"200":{"description":"One page of documents with tab counts","content":{"application/json":{"schema":{"type":"object","required":["success","documents","total","page","pageSize","totalPages"],"properties":{"success":{"type":"boolean","enum":[true]},"documents":{"type":"array","items":{"$ref":"#/components/schemas/DocumentLibraryItem"}},"total":{"type":"integer"},"libraryTotal":{"type":"integer"},"counts":{"type":"object","additionalProperties":{"type":"integer"}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"totalPages":{"type":"integer"},"warning":{"type":"string"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/documents/{documentId}/detail":{"get":{"operationId":"getDocumentsDocumentIdDetail","summary":"Get Document Detail","description":"One document record for the full-page library inspector, including soft-deleted documents the caller may access.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Document","content":{"application/json":{"schema":{"type":"object","required":["success","document"],"properties":{"success":{"type":"boolean","enum":[true]},"document":{"$ref":"#/components/schemas/DocumentLibraryItem"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Forbidden"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}}}},"/api/v1/documents/{documentId}/url":{"get":{"operationId":"getDocumentsDocumentIdUrl","summary":"Get Documents Url","description":"Get Documents Url in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Presigned document URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUrlResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/documents/{documentId}/views":{"get":{"operationId":"getDocumentsDocumentIdViews","summary":"Get Documents Views","description":"Get Documents Views in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Document view history","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentViewsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/documents/cases-for-picker":{"get":{"operationId":"getDocumentsCasesForPicker","summary":"List Documents Cases For Picker","description":"List Documents Cases For Picker in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Cases","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCasesResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/documents/folders":{"get":{"operationId":"getDocumentsFolders","summary":"List Documents Folders","description":"List Documents Folders in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Folders","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentFoldersResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"post":{"operationId":"postDocumentsFolders","summary":"Create or run Documents Folders","description":"Create or run Documents Folders in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Folder created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentFolderResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentFolderCreateRequest"}}}}}},"/api/v1/legal/status":{"get":{"operationId":"getLegalStatus","summary":"List Legal Status","description":"List Legal Status in the Planlined legal workflow.","tags":["Legal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/parse/status":{"get":{"operationId":"getParseStatus","summary":"List Parse Status","description":"List Parse Status in the Planlined parse workflow.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseStatusResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/parse/unified/health":{"get":{"operationId":"getParseUnifiedHealth","summary":"List Parse Unified Health","description":"List Parse Unified Health in the Planlined parse workflow.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnifiedParseHealthResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/portal/providers/search":{"get":{"operationId":"getPortalProvidersSearch","summary":"List Portal Providers Search","description":"List Portal Providers Search in the Planlined enrollment portal workflow.","tags":["Enrollment Portal"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}}}},"/api/v1/rag/preferences/case-grounding":{"get":{"operationId":"getRagPreferencesCaseGrounding","summary":"List Rag Preferences Case Grounding","description":"List Rag Preferences Case Grounding in the Planlined rag workflow.","tags":["RAG"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseGroundingPreference"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}},"put":{"operationId":"putRagPreferencesCaseGrounding","summary":"Replace Rag Preferences Case Grounding","description":"Replace Rag Preferences Case Grounding in the Planlined rag workflow.","tags":["RAG"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseGroundingPreference"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseGroundingPreference"}}}}}},"/api/web-reports/{reportId}/analytics/engagement":{"get":{"operationId":"getWebReportsReportIdAnalyticsEngagement","summary":"Get Analytics Engagement","description":"Get Analytics Engagement in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportEngagementAnalyticsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/web-reports/{reportId}/analytics/timeline":{"get":{"operationId":"getWebReportsReportIdAnalyticsTimeline","summary":"Get Analytics Timeline","description":"Get Analytics Timeline in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportEngagementTimelineResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}]}},"/api/web-reports/{reportId}/notifications":{"get":{"operationId":"getWebReportsReportIdNotifications","summary":"Get Notifications","description":"Get Notifications in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportNotificationSettingsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}]},"put":{"operationId":"putWebReportsReportIdNotifications","summary":"Replace Notifications","description":"Replace Notifications in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportNotificationUpdateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"},"503":{"description":"Notification settings storage is unavailable or not enabled"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportNotificationSettingsRequest"},"examples":{"request":{"summary":"Configure report notifications","value":{"emailOnView":true,"emailOnSign":true,"notifyEmail":"broker@acme.com"}}}}}}}},"/api/web-reports/case/{caseId}":{"get":{"operationId":"getWebReportsCaseCaseId","summary":"Get Case","description":"Get Case in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportsForCaseResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/web-reports/dashboard/list":{"get":{"operationId":"getWebReportsDashboardList","summary":"List Dashboard List","description":"List Dashboard List in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportDashboardListResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"parameters":[{"name":"filter","in":"query","required":false,"schema":{"type":"string","enum":["all","active","expired","live","expiring-soon"],"default":"all"}},{"name":"caseId","in":"query","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","required":false,"schema":{"type":"string"}},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["created","expires","views","title"],"default":"created"}},{"name":"sortOrder","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":20}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0}}]}},"/api/web-reports/dashboard/stats":{"get":{"operationId":"getWebReportsDashboardStats","summary":"List Dashboard Stats","description":"List Dashboard Stats in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportDashboardStatsResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}}}},"/api/v1/documents/{documentId}/folder":{"patch":{"operationId":"patchDocumentsDocumentIdFolder","summary":"Update Documents Folder","description":"Update Documents Folder in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Folder assigned","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"folderId":{"type":"string","nullable":true}}}}}}}},"/api/v1/documents/{documentId}/rename":{"patch":{"operationId":"patchDocumentsDocumentIdRename","summary":"Update Documents Rename","description":"Update Documents Rename in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Document renamed","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["filename"],"properties":{"filename":{"type":"string","minLength":1,"maxLength":255}}}}}}}},"/api/v1/documents/cases/{caseId}/rename":{"patch":{"operationId":"patchDocumentsCasesCaseIdRename","summary":"Update Documents Cases Rename","description":"Update Documents Cases Rename in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Case renamed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCaseAssignmentResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1}}}}}}}},"/api/web-reports/{reportId}/signature":{"patch":{"operationId":"patchWebReportsReportIdSignature","summary":"Update Signature","description":"Update Signature in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSignatureRequirementResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSignatureRequirementRequest"}}}}}},"/api/web-reports/bulk/extend":{"patch":{"operationId":"patchWebReportsBulkExtend","summary":"Update Bulk Extend","description":"Update Bulk Extend in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportBulkExtendResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportBulkExtendRequest"}}}}}},"/api/cases/{caseId}/plans/links/batch":{"post":{"operationId":"postCasesCaseIdPlansLinksBatch","summary":"Create or run Plans Links Batch","description":"Create or run Plans Links Batch in the Planlined cases workflow.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Plan links created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkBatchResponse"}}}},"400":{"description":"Invalid plan-link request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"429":{"description":"Plan-link rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"500":{"description":"Failed to create plan links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}}},"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkBatchRequest"}}}}}},"/api/cms/ichra-affordability":{"post":{"operationId":"postCmsIchraAffordability","summary":"Create or run Ichra Affordability","description":"Create or run Ichra Affordability in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsIchraAffordabilityRequest"}}}}}},"/api/cms/ichra-affordability/bulk":{"post":{"operationId":"postCmsIchraAffordabilityBulk","summary":"Create or run Ichra Affordability Bulk","description":"Create or run Ichra Affordability Bulk in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsIchraBulkRequest"}}}}}},"/api/cms/plans/search":{"post":{"operationId":"postCmsPlansSearch","summary":"Create or run Plans Search","description":"Create or run Plans Search in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsPlanSearchRequest"}}}}}},"/api/cms/slcsp":{"post":{"operationId":"postCmsSlcsp","summary":"Create or run Slcsp","description":"Create or run Slcsp in the Planlined cms marketplace workflow.","tags":["CMS Marketplace"],"security":[],"responses":{"200":{"description":"CMS Marketplace data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CmsSlcspRequest"}}}}}},"/api/custom-oauth/disconnect/{disconnectId}":{"post":{"operationId":"postCustomOauthDisconnectDisconnectId","summary":"Disconnect a custom OAuth provider","description":"Disconnect a custom OAuth provider in the Planlined custom oauth workflow.","tags":["Custom OAuth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Provider disconnected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomOAuthDisconnectResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"disconnectId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/email/case-ready":{"post":{"operationId":"postEmailCaseReady","summary":"Create or run Case Ready","description":"Create or run Case Ready in the Planlined email workflow.","tags":["Email"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/enrollment-batch/auto-match":{"post":{"operationId":"postEnrollmentBatchAutoMatch","summary":"Create or run Auto Match","description":"Create or run Auto Match in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"Suggested PDF-to-spreadsheet field mapping","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentAutoMatchResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentAutoMatchRequest"}}}}}},"/api/enrollment-batch/extract-fields":{"post":{"operationId":"postEnrollmentBatchExtractFields","summary":"Create or run Extract Fields","description":"Create or run Extract Fields in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"Extracted PDF form fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentExtractFieldsResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/EnrollmentExtractFieldsUploadRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentExtractFieldsJsonRequest"}}}}}},"/api/enrollment-batch/process":{"post":{"operationId":"postEnrollmentBatchProcess","summary":"Create or run Process","description":"Create or run Process in the Planlined enrollment batch workflow.","tags":["Enrollment Batch"],"security":[{"bearerAuth":[]},{}],"responses":{"200":{"description":"Completed batch results as JSON or ZIP","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchProcessResponse"}},"application/zip":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchUploadRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentBatchJsonRequest"}}}}}},"/api/exports":{"post":{"operationId":"postExports","summary":"Create or run resource","description":"Create or run resource in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Export queued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportQueuedResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportRequest"}}}}}},"/api/exports/email":{"post":{"operationId":"postExportsEmail","summary":"Create or run Email","description":"Create or run Email in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailExportResponse"},"example":{"ok":true,"messageId":"msg_001"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailExportRequest"},"examples":{"request":{"summary":"Email a report with optional PDF","value":{"to":"client@acme.com","subject":"Your Benefit Report","reportData":{"plans":[{"name":"Regence HDHP 3000"}]},"includePdf":true,"templateId":"default"}}}}}}}},"/api/exports/employee-comm-email":{"post":{"operationId":"postExportsEmployeeCommEmail","summary":"Create or run Employee Comm Email","description":"Create or run Employee Comm Email in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Email sent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailExportResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeCommunicationEmailRequest"}}}}}},"/api/exports/excel":{"post":{"operationId":"postExportsExcel","summary":"Create or run Excel","description":"Create or run Excel in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Generated Excel workbook","content":{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{},"example":{"ok":true,"id":"export_abc456","status":"completed","fileSize":8900,"createdAt":"2025-01-01T00:00:00Z"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExcelExportRequest"},"examples":{"request":{"summary":"Generate XLSX from data","value":{"sheets":[{"name":"Plans","data":[["Name","Carrier","Premium"],["HDHP 3000","Regence",450]]}],"filename":"plans.xlsx"}}}}}}}},"/api/exports/json":{"post":{"operationId":"postExportsJson","summary":"Create or run Json","description":"Create or run Json in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Exported report JSON","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonExportResponse"},"example":{"ok":true,"data":{"plans":[{"name":"Regence HDHP 3000","carrier":"Regence","premium":450}]}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonExportRequest"},"examples":{"request":{"summary":"Export report data as JSON","value":{"reportData":{"plans":[{"name":"Regence HDHP 3000"}]},"format":"json"}}}}}}}},"/api/exports/pdf":{"post":{"operationId":"postExportsPdf","summary":"Create or run Pdf","description":"Create or run Pdf in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Generated PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{},"example":{"ok":true,"id":"export_abc123","status":"completed","fileSize":125000,"createdAt":"2025-01-01T00:00:00Z"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfExportRequest"},"examples":{"request":{"summary":"Generate PDF from HTML","value":{"html":"<html><body><h1>Report</h1><table>...</table></body></html>","filename":"report.pdf","options":{"landscape":true}}}}}}}}},"/api/exports/pdf-from-url":{"post":{"operationId":"postExportsPdfFromUrl","summary":"Create or run Pdf From Url","description":"Create or run Pdf From Url in the Planlined exports workflow.","tags":["Exports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Generated PDF","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfFromUrlExportRequest"}}}}}},"/api/external-apps/oauth/apps/{appId}/rotate-secret":{"post":{"operationId":"postExternalAppsOauthAppsAppIdRotateSecret","summary":"Create or run Oauth Apps Rotate Secret","description":"Create or run Oauth Apps Rotate Secret in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthSecretRotationResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/external-apps/oauth/revoke":{"post":{"operationId":"postExternalAppsOauthRevoke","summary":"Revoke an OAuth token","description":"Revoke an OAuth token in the Planlined external apps workflow.","tags":["External Apps"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthRevokeResponse"}}}},"400":{"description":"Missing token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/ExternalOAuthRevokeRequest"}}}}}},"/api/external-apps/oauth/register":{"post":{"operationId":"postExternalAppsOauthRegister","summary":"Register a public OAuth client","description":"RFC 7591 dynamic client registration for AI connectors. Unauthenticated; public clients only (token_endpoint_auth_method none). Redirect URIs must be a supported AI connector callback or a loopback address. Self-registered clients are limited to read:cases write:cases read:plans write:plans offline_access; the scope field is ignored. Rate limited per IP.","tags":["External Apps"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["redirect_uris"],"properties":{"client_name":{"type":"string","maxLength":100},"redirect_uris":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":5},"token_endpoint_auth_method":{"type":"string","enum":["none"],"default":"none"},"scope":{"type":"string","description":"Ignored; granted scopes are fixed."}}}}}},"responses":{"201":{"description":"Client registered","content":{"application/json":{"schema":{"type":"object","required":["client_id","client_id_issued_at","client_name","redirect_uris","grant_types","response_types","token_endpoint_auth_method","scope"],"properties":{"client_id":{"type":"string"},"client_id_issued_at":{"type":"integer","description":"Unix seconds"},"client_name":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string"}},"grant_types":{"type":"array","items":{"type":"string"}},"response_types":{"type":"array","items":{"type":"string"}},"token_endpoint_auth_method":{"type":"string","enum":["none"]},"scope":{"type":"string","description":"Space-separated granted scopes"}}}}}},"400":{"description":"invalid_redirect_uri or invalid_client_metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"description":"server_error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}}}}},"/api/external-apps/oauth/grants":{"get":{"operationId":"getExternalAppsOauthGrants","summary":"List connected OAuth apps","description":"AI apps and other OAuth clients the signed-in user has authorized. An app is listed while it holds an active refresh token. Requires scope integrations:read.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","required":["success","grants"],"properties":{"success":{"type":"boolean"},"grants":{"type":"array","items":{"type":"object","required":["clientId","appName","logoUrl","destination","selfRegistered","scopes","connectedAt","lastAuthorizedAt"],"properties":{"clientId":{"type":"string"},"appName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"destination":{"type":"string","nullable":true,"description":"Host of the first redirect URI"},"selfRegistered":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"string"},"description":"Display names; offline_access is omitted"},"connectedAt":{"type":"string","format":"date-time"},"lastAuthorizedAt":{"type":"string","format":"date-time"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"description":"Grants could not be listed","content":{"application/json":{"schema":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string","enum":["grants_unavailable"]}}}}}}}}},"/api/external-apps/oauth/grants/{clientId}":{"delete":{"operationId":"deleteExternalAppsOauthGrantsClientId","summary":"Disconnect an OAuth app","description":"Revokes the signed-in user's refresh and access tokens for the app and burns unexchanged authorization codes. Requires scope integrations:write.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","required":["success","revoked"],"properties":{"success":{"type":"boolean"},"revoked":{"type":"integer","description":"Refresh tokens revoked"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"description":"Disconnect failed","content":{"application/json":{"schema":{"type":"object","required":["success","error"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string","enum":["revoke_failed"]}}}}}}}}},"/api/external-apps/oauth/token":{"post":{"operationId":"postExternalAppsOauthToken","summary":"Exchange an OAuth authorization grant","description":"Exchange an OAuth authorization grant in the Planlined external apps workflow.","tags":["External Apps"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthTokenResponse"}}}},"400":{"description":"Invalid OAuth grant request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}},"401":{"description":"Invalid OAuth client credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}},"500":{"description":"OAuth token service failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalOAuthErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/ExternalOAuthTokenRequest"}}}}}},"/api/market/ai-insights":{"post":{"operationId":"postMarketAiInsights","summary":"Create or run Ai Insights","description":"Create or run Ai Insights in the Planlined market workflow.","tags":["Market"],"security":[],"responses":{"200":{"description":"AI market insights","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketAiInsightsRequest"}}}}}},"/api/market/mployer/broker/search":{"post":{"operationId":"postMarketMployerBrokerSearch","summary":"Create or run Mployer Broker Search","description":"Create or run Mployer Broker Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerBrokerSearchRequest"}}}}}},"/api/market/mployer/carrier/search":{"post":{"operationId":"postMarketMployerCarrierSearch","summary":"Create or run Mployer Carrier Search","description":"Create or run Mployer Carrier Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerCarrierSearchRequest"}}}}}},"/api/market/mployer/company/search":{"post":{"operationId":"postMarketMployerCompanySearch","summary":"Create or run Mployer Company Search","description":"Create or run Mployer Company Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerCompanySearchRequest"}}}}}},"/api/market/mployer/compare":{"post":{"operationId":"postMarketMployerCompare","summary":"Create or run Mployer Compare","description":"Create or run Mployer Compare in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerCompareRequest"}}}}}},"/api/market/mployer/contact/search":{"post":{"operationId":"postMarketMployerContactSearch","summary":"Create or run Mployer Contact Search","description":"Create or run Mployer Contact Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerContactSearchRequest"}}}}}},"/api/market/mployer/employer/search":{"post":{"operationId":"postMarketMployerEmployerSearch","summary":"Create or run Mployer Employer Search","description":"Create or run Mployer Employer Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerEmployerSearchRequest"}}}}}},"/api/market/mployer/insights":{"post":{"operationId":"postMarketMployerInsights","summary":"Create or run Mployer Insights","description":"Create or run Mployer Insights in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerInsightsRequest"}}}}}},"/api/market/mployer/peo/search":{"post":{"operationId":"postMarketMployerPeoSearch","summary":"Create or run Mployer Peo Search","description":"Create or run Mployer Peo Search in the Planlined market workflow.","tags":["Market"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mployer data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketApiResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MployerPeoSearchRequest"}}}}}},"/api/organizations/{orgId}/invitations/batch":{"post":{"operationId":"postOrganizationsOrgIdInvitationsBatch","summary":"Create or run Invitations Batch","description":"Create or run Invitations Batch in the Planlined organizations workflow.","tags":["Organizations"],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Batch invitations processed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationBatchInvitationResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationBatchInvitationRequest"}}}}}},"/api/plan-library/bulk-reparse/apply":{"post":{"operationId":"postPlanLibraryBulkReparseApply","summary":"Create or run Bulk Reparse Apply","description":"Create or run Bulk Reparse Apply in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Applied selected benefit and premium changes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseApplyResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseApplyRequest"}}}}}},"/api/plan-library/bulk-reparse/preview":{"post":{"operationId":"postPlanLibraryBulkReparsePreview","summary":"Create or run Bulk Reparse Preview","description":"Create or run Bulk Reparse Preview in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Bulk re-parse comparison report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseReport"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseFilterRequest"}}}}}},"/api/plan-library/bulk-reparse/reparse-plan":{"post":{"operationId":"postPlanLibraryBulkReparseReparsePlan","summary":"Create or run Bulk Reparse Reparse Plan","description":"Create or run Bulk Reparse Reparse Plan in the Planlined parse workflow.","tags":["Plan Library"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Single-plan re-parse comparison","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparsePlanResult"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkReparseSingleRequest"}}}}}},"/api/share-files/upload":{"post":{"operationId":"postShareFilesUpload","summary":"Create or run Upload","description":"Create or run Upload in the Planlined file sharing workflow.","tags":["File Sharing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"additionalProperties":true}}}}}},"/api/signatures":{"post":{"operationId":"postSignatures","summary":"Create or run resource","description":"Create or run resource in the Planlined signatures workflow.","tags":["Signatures"],"security":[],"responses":{"201":{"description":"Signature submitted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureCreateResponse"}}}},"400":{"description":"Invalid signature submission","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}},"500":{"description":"Signature submission failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignatureCreateRequest"}}}}}},"/api/v1/documents/{documentId}/carrier":{"post":{"operationId":"setDocumentCarrier","summary":"Set or clear a document's carrier association","description":"Manually associates a library document with a carrier for the Carriers & Networks book QR code. An empty or omitted carrierKey clears the association.","tags":["Documents"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"carrierKey":{"type":"string","nullable":true,"description":"Carrier identifier to associate. Empty or omitted clears the association."}}}}}},"responses":{"200":{"description":"Carrier association updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"carrierKey":{"type":"string","nullable":true,"description":"The stored carrier key, or null when the association was cleared."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Caller lacks access to the document"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}}}},"/api/v1/documents/{documentId}/case":{"post":{"operationId":"postDocumentsDocumentIdCase","summary":"Create or run Documents Case","description":"Create or run Documents Case in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Document assigned to case","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentCaseAssignmentResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["caseId"],"properties":{"caseId":{"type":"string"}}}}}}}},"/api/v1/documents/{documentId}/restore":{"post":{"operationId":"postDocumentsDocumentIdRestore","summary":"Create or run Documents Restore","description":"Create or run Documents Restore in the Planlined documents workflow.","tags":["Documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Document restored","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"documentId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/legal/accept":{"post":{"operationId":"postLegalAccept","summary":"Create or run Legal Accept","description":"Create or run Legal Accept in the Planlined legal workflow.","tags":["Legal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/parse/census":{"post":{"operationId":"postParseCensus","summary":"Create or run Parse Census","description":"Create or run Parse Census in the Planlined parse workflow.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseCensusResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseCensusUploadRequest"}}}}}},"/api/v1/parse/image":{"post":{"operationId":"postParseImage","summary":"Create or run Parse Image","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseImageResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseImageUploadRequest"}}}}}},"/api/v1/parse/invoice":{"post":{"operationId":"postParseInvoice","summary":"Create or run Parse Invoice","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","deprecated":true,"tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParsePlansResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseDocumentUploadRequest"}}}}}},"/api/v1/parse/quote":{"post":{"operationId":"postParseQuote","summary":"Create or run Parse Quote","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","deprecated":true,"tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParsePlansResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseQuoteUploadRequest"}}}}}},"/api/v1/parse/sbc":{"post":{"operationId":"postParseSbc","summary":"Create or run Parse Sbc","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseSbcResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseDocumentUploadRequest"}}}}}},"/api/v1/parse/spreadsheet":{"post":{"operationId":"postParseSpreadsheet","summary":"Create or run Parse Spreadsheet","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseSpreadsheetResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseSpreadsheetUploadRequest"}}}}}},"/api/v1/parse/xml":{"post":{"operationId":"postParseXml","summary":"Create or run Parse Xml","description":"Removed (410 Gone). Use POST /api/v1/parse/unified; the response body is {\"error\":\"route_removed\",\"use\":\"/api/v1/parse/unified\"}.","tags":["Parse"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParseXmlResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"410":{"description":"Gone: the route was removed; use POST /api/v1/parse/unified"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/ParseXmlUploadRequest"}}}}}},"/api/v1/portal/distribute":{"post":{"operationId":"postPortalDistribute","summary":"Distribute an enrollment portal","description":"Distribute an enrollment portal in the Planlined enrollment portal workflow.","tags":["Enrollment Portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"/api/v1/portal/logo":{"post":{"operationId":"postPortalLogo","summary":"Upload an enrollment portal logo","description":"Upload an enrollment portal logo in the Planlined enrollment portal workflow.","tags":["Enrollment Portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"logo":{"type":"string","format":"binary"}},"additionalProperties":true}}}}}},"/api/v1/rag/cases/{caseId}/status":{"get":{"operationId":"getRagCaseIndexStatus","summary":"Get case evidence index status","description":"Returns bounded indexing freshness and queue state for a case owned by the authenticated user. A foreign case and a nonexistent case return the same response.","tags":["RAG"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200}}],"responses":{"200":{"description":"Owner-scoped case evidence index status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexStatusResponse"}}}},"400":{"description":"Invalid case identifier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The integration credential lacks cases:read scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexScopeError"}}}},"404":{"description":"Case not found or not owned by the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"500":{"description":"Case evidence status is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}}}}},"/api/v1/rag/cases/{caseId}/refresh":{"post":{"operationId":"postRagCaseIndexRefresh","summary":"Request a case evidence refresh","description":"Idempotently queues an owner-only refresh for one stale or unindexed case. It never rebuilds the shared knowledge corpus.","tags":["RAG"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":200}}],"responses":{"202":{"description":"Refresh queued, or an existing in-flight refresh reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexRefreshResponse"}}}},"400":{"description":"Invalid case identifier","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"The organization AI budget prevents refresh or the integration credential lacks cases:write scope","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/RagCaseIndexError"},{"$ref":"#/components/schemas/RagCaseIndexScopeError"}]}}}},"404":{"description":"Case not found or not owned by the authenticated user","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"409":{"description":"Refresh is disabled, unnecessary, or needs support","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"429":{"description":"Refresh request rate limit exceeded","headers":{"Retry-After":{"description":"Seconds until another refresh request may be attempted","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}},"500":{"description":"Case evidence refresh is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagCaseIndexError"}}}}}}},"/api/v1/rag/query":{"post":{"operationId":"postRagQuery","summary":"Query the Planlined knowledge corpus","description":"Query the Planlined knowledge corpus in the Planlined rag workflow.","tags":["RAG"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagQueryResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RagQueryRequest"}}}}}},"/api/web-reports/{reportId}/engagement":{"post":{"operationId":"postWebReportsReportIdEngagement","summary":"Create or run Engagement","description":"Create or run Engagement in the Planlined web reports workflow.","tags":["Web Reports"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportEngagementAcceptedResponse"},"example":{"ok":true}}}},"202":{"description":"Engagement accepted for fire-and-forget processing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportEngagementAcceptedResponse"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportEngagementRequest"},"examples":{"request":{"summary":"Track report engagement","value":{"event":"page.viewed","page":1,"duration":45}}}}}}}},"/api/web-reports/{reportId}/migrate-mobile":{"post":{"operationId":"postWebReportsReportIdMigrateMobile","summary":"Create or run Migrate Mobile","description":"Create or run Migrate Mobile in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSingleMobileMigrationResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSingleMobileMigrationRequest"}}}}}},"/api/web-reports/{reportId}/regenerate-server-side":{"post":{"operationId":"postWebReportsReportIdRegenerateServerSide","summary":"Create or run Regenerate Server Side","description":"Create or run Regenerate Server Side in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportRegenerateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportRegenerateRequest"}}}}}},"/api/web-reports/{reportId}/sign":{"post":{"operationId":"postWebReportsReportIdSign","summary":"Create or run Sign","description":"Create or run Sign in the Planlined web reports workflow.","tags":["Web Reports"],"security":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSignResponse"},"example":{"ok":true,"signedAt":"2025-01-01T00:00:00Z"}}}},"400":{"description":"Invalid request"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"reportId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportSignRequest"},"examples":{"request":{"summary":"Sign a report with drawn signature","value":{"signature":"data:image/png;base64,...","signerName":"John Doe","signerEmail":"john@acme.com"}}}}}}}},"/api/web-reports/bulk/delete":{"post":{"operationId":"postWebReportsBulkDelete","summary":"Create or run Bulk Delete","description":"Create or run Bulk Delete in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportBulkDeleteResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportBulkDeleteRequest"}}}}}},"/api/web-reports/migrate-mobile":{"post":{"operationId":"postWebReportsMigrateMobile","summary":"Create or run Migrate Mobile","description":"Create or run Migrate Mobile in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportMobileMigrationResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportMobileMigrationRequest"}}}}}},"/api/web-reports/preview-ebc":{"post":{"operationId":"postWebReportsPreviewEbc","summary":"Create or run Preview Ebc","description":"Create or run Preview Ebc in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Rendered Employee Benefit Center preview HTML","content":{"text/html":{"schema":{"type":"string"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportPreviewEbcRequest"}}}}}},"/api/web-reports/republish-ebc":{"post":{"operationId":"postWebReportsRepublishEbc","summary":"Create or run Republish Ebc","description":"Create or run Republish Ebc in the Planlined web reports workflow.","tags":["Web Reports"],"security":[{"bearerAuth":[]}],"parameters":[{"name":"If-Match","in":"header","required":true,"schema":{"type":"string","example":"\"v1\""}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportRepublishEbcResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Internal server error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebReportRepublishEbcRequest"}}}}}},"/api/webhooks/deliveries/{deliveryId}/retry":{"post":{"operationId":"postWebhooksDeliveriesDeliveryIdRetry","summary":"Create or run Deliveries Retry","description":"Create or run Deliveries Retry in the Planlined webhooks workflow.","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Delivery queued for retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRetryResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/webhooks/subscriptions/{subscriptionId}/rotate-secret":{"post":{"operationId":"postWebhooksSubscriptionsSubscriptionIdRotateSecret","summary":"Create or run Subscriptions Rotate Secret","description":"Create or run Subscriptions Rotate Secret in the Planlined webhooks workflow.","tags":["Webhooks"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"responses":{"200":{"description":"Signing secret rotated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRotateSecretResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"subscriptionId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/enrollment-mappings/{id}":{"delete":{"operationId":"deleteEnrollmentMappingsEnrollmentmappingsId","summary":"Delete resource","description":"Delete resource in the Planlined enrollment mappings workflow.","tags":["Enrollment Mappings"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Mapping deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentMappingDeletedResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1},"description":"Saved mapping identifier"}]}},"/api/external-apps/api-keys/{keyId}":{"delete":{"operationId":"deleteExternalAppsApiKeysApiKeyId","summary":"Delete Api Keys","description":"Delete Api Keys in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyRevokeResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"keyId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyRevokeRequest"}}}}},"put":{"operationId":"putExternalAppsApiKeysApiKeyId","summary":"Replace Api Keys","description":"Replace Api Keys in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyUpdateResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"keyId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyUpdateRequest"}}}}}},"/api/external-apps/api-keys/{keyId}/usage":{"get":{"operationId":"getExternalAppsApiKeysApiKeyIdUsage","summary":"Get Api Keys Usage","description":"Get Api Keys Usage in the Planlined external apps workflow.","tags":["External Apps"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiKeyUsageResponse"}}}},"400":{"description":"Invalid request"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Resource not found"},"500":{"description":"Internal server error"}},"parameters":[{"name":"keyId","in":"path","required":true,"schema":{"type":"string"}},{"in":"query","required":false,"name":"days","schema":{"type":"integer","minimum":1,"default":7}}]}},"/api/cases/{caseId}/plans/{planId}/links":{"get":{"operationId":"getCasesCaseIdPlansPlanIdLinks","summary":"Get Plans Links","description":"Get Plans Links in the Planlined cases workflow.","tags":["Cases"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Plan links retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinksForPlanResponse"}}}},"400":{"description":"Invalid plan-link request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"description":"Case not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"429":{"description":"Plan-link rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}},"500":{"description":"Failed to get plan links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLinkErrorResponse"}}}}},"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/chat/messages/{ordinal}":{"delete":{"operationId":"deleteChatMessagesOrdinal","summary":"Delete Chat Messages","description":"Delete Chat Messages in the Planlined chat workflow.","tags":["Chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Chat message deleted when present","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatDeleteMessagesResponse"}}}},"400":{"description":"Ordinal is not a finite integer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"description":"Failed to delete chat message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatErrorResponse"}}}}},"parameters":[{"name":"ordinal","in":"path","required":true,"description":"Server-assigned chronological message ordinal.","schema":{"type":"integer","minimum":0}},{"name":"caseId","in":"query","required":false,"description":"Case-scoped conversation key.","schema":{"type":"string","maxLength":128,"default":"default"}}]}},"/api/v1/ebc/events":{"post":{"summary":"Ingest EBC analytics events","description":"Batch ingest of employee benefit center engagement analytics events. Upserts into ebc_engagement by (ebc_code, session_id). Accepts up to 50 events per request.","tags":["Analytics"],"security":[{}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["events"],"properties":{"events":{"type":"array","maxItems":50,"minItems":1,"items":{"type":"object","required":["name","ebcCode","sessionId"],"properties":{"name":{"type":"string","description":"Event name (e.g. chapter.entered, video.played)"},"ebcCode":{"type":"string","maxLength":64,"description":"EBC identifier code"},"sessionId":{"type":"string","maxLength":64,"description":"Browser session identifier"},"payload":{"type":"object","description":"Event-specific payload"},"tokenPresent":{"type":"boolean","description":"Whether user had an auth token"},"viewport":{"type":"string","description":"Browser viewport dimensions"},"tsISO":{"type":"string","format":"date-time","description":"Event timestamp"}}}}}},"examples":{"request":{"value":{"events":[{"name":"chapter.entered","ebcCode":"ACME-2025","sessionId":"sess_abc123","payload":{"chapterId":"medicalPlans","benefitType":"medical"},"tokenPresent":true,"viewport":"1920x1080","tsISO":"2025-01-01T00:00:00Z"}]}}}}}},"responses":{"202":{"description":"Events accepted for processing","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"integer","description":"Number of events accepted"}}}}}},"400":{"description":"Invalid request (bad payload, empty events, too many events)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"500":{"description":"Ingest failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}},"operationId":"postEbcEvents"}},"/api/v1/case-imports":{"get":{"summary":"List durable case imports","description":"Returns a tenant-scoped, cursor-paginated history of case imports. Filters are bound into the opaque cursor so cursors cannot be replayed across organizations or filter sets.","operationId":"listCaseImportsV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","description":"Comma-separated case-import statuses.","schema":{"type":"string","example":"failed,dead_letter"}},{"name":"mode","in":"query","schema":{"type":"string","enum":["automatic","review"]}},{"name":"operation","in":"query","schema":{"type":"string","enum":["create","update"]}},{"name":"createdAfter","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"createdBefore","in":"query","schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Cursor-paginated case-import history","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportListResponse"}}}},"400":{"description":"Invalid filter, date range, cursor, or caller scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing cases read or import scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Case import list failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Case import storage is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Submit source files for durable case import","description":"Retains every source file, parses multiple plans and benefit types asynchronously, and either creates a new case or proposes a version-guarded merge into targetCaseId. Existing-case imports preserve untouched case setup, contributions, plans, and report data. Automatic updates commit only when benefit mappings are unambiguous and expectedVersion still matches.","operationId":"submitCaseImportV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CaseImportSubmission"}}}},"responses":{"202":{"description":"Case import accepted","headers":{"Location":{"description":"Relative URL of the durable case-import resource.","schema":{"type":"string"}},"Retry-After":{"description":"Suggested polling delay in seconds.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportAcceptedResponse"}}}},"400":{"description":"Invalid multipart submission or organization context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing cases:import or cases:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Target case not found in the caller scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"412":{"description":"Target case expectedVersion is stale","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Case import fields failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Case import submission failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Database or source-document persistence unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/case-imports/{caseImportId}":{"get":{"summary":"Get a durable case import","description":"Returns parsing progress, the review candidate, commit state, and links for an organization-scoped case import.","operationId":"getCaseImportV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseImportId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Case import state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportReadResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing cases read or import scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case import not found in the caller organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Case import read failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Case import storage is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/case-imports/{caseImportId}/retry":{"post":{"summary":"Retry a failed case import","description":"Requeues a retryable failed or dead-lettered import in place, preserving the original import id and retained source documents. Already committed imports are recovered and returned without another case write. Blocked validation results, version conflicts, active jobs, and completed jobs are not retryable.","operationId":"retryCaseImportV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseImportId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"A previously committed case import was recovered without reprocessing","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportRetryResponse"}}}},"202":{"description":"Case import queued for retry","headers":{"Location":{"description":"Relative URL of the existing case-import resource.","schema":{"type":"string"}},"Retry-After":{"description":"Suggested polling delay in seconds.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportRetryResponse"}}}},"400":{"description":"Invalid caller scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing cases import or write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case import not found in the caller scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Case import state is not retryable or changed concurrently","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Case import retry failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Case import storage is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/case-imports/{caseImportId}/commit":{"post":{"summary":"Commit a reviewed case import","description":"Commits a new-case candidate through the canonical create writer, or commits proposedChanges for an existing case through mergePatchVersioned with the submission expectedVersion as If-Match. Existing-case commits return 412 if the case changed after parsing. Repeating the same idempotency key safely replays the committed response.","operationId":"commitCaseImportV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseImportId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportCommitRequest"}}}},"responses":{"200":{"description":"Previously committed case import replayed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportCommitResponse"}}}},"201":{"description":"Reviewed case candidate committed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseImportCommitResponse"}}}},"400":{"description":"Invalid caller scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Missing cases:write scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Case import not found in the caller organization","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Case import is not ready, mismatched, or already being committed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"412":{"description":"Target case changed after parsing; submit a new import against the current version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Approved case candidate failed validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Case import commit failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Case import storage is temporarily unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/cases":{"get":{"summary":"List cases for a partner integration","description":"Returns cases visible to the authenticated principal using opaque cursor pagination. Offset remains available only for compatibility and cannot be combined with cursor.","operationId":"listPartnerCasesV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","description":"Maximum items per page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor returned in pageInfo.nextCursor.","schema":{"type":"string"}},{"name":"offset","in":"query","deprecated":true,"description":"Compatibility offset. Do not combine with cursor.","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Cursor-paginated cases.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseListResponse"}}}},"400":{"description":"Invalid cursor or conflicting pagination modes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorErrorResponse"}}}},"401":{"description":"Authentication required."},"403":{"description":"The credential lacks cases:read."}}},"post":{"summary":"Create a canonical case","description":"Creates a UI-equivalent case document. setupVersion must be 1.1. The credential determines the organization boundary; orgId cannot escape it.","operationId":"createPartnerCaseV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionedCaseWriteRequest"}}}},"responses":{"201":{"description":"Case created.","headers":{"ETag":{"description":"Quoted case row version.","schema":{"type":"string"}},"Location":{"description":"Versioned case resource URL.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseWriteResponse"}}}},"400":{"description":"Malformed request."},"401":{"description":"Authentication required."},"403":{"description":"Credential lacks cases:write or organization access."},"409":{"description":"Case ID or idempotency conflict."},"422":{"description":"Case setup is semantically invalid."}}}},"/api/v1/cases/{id}":{"get":{"summary":"Get a canonical case","operationId":"getPartnerCaseV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Canonical case document.","headers":{"ETag":{"description":"Quoted case row version.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseReadResponse"}}}},"401":{"description":"Authentication required."},"403":{"description":"Credential lacks cases:read or organization access."},"404":{"description":"Case not found."}}},"put":{"summary":"Replace a canonical case","description":"Fully replaces the canonical document. setupVersion 1.1 and If-Match are required.","operationId":"replacePartnerCaseV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionedCaseWriteRequest"}}}},"responses":{"200":{"description":"Case replaced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseWriteResponse"}}}},"409":{"description":"Body ID mismatch or organization transfer attempted."},"412":{"description":"If-Match is stale."},"422":{"description":"Replacement is semantically invalid."},"428":{"description":"If-Match is required."}}},"patch":{"summary":"Merge-patch a canonical case","description":"Applies RFC 7396 JSON Merge Patch to the stored case, validates the resulting setupVersion 1.1 document, and commits it with If-Match.","operationId":"patchPartnerCaseV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/merge-patch+json":{"schema":{"$ref":"#/components/schemas/CaseCreateRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/CaseCreateRequest"}}}},"responses":{"200":{"description":"Case patched.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseWriteResponse"}}}},"400":{"description":"Malformed or unsafe merge patch."},"409":{"description":"Body ID mismatch or organization transfer attempted."},"412":{"description":"If-Match is stale."},"422":{"description":"Merged case is semantically invalid."},"428":{"description":"If-Match is required."}}},"delete":{"summary":"Delete a case","operationId":"deletePartnerCaseV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Case deleted."},"403":{"description":"Only the owner can delete the case."},"404":{"description":"Case not found."},"412":{"description":"If-Match is stale."},"428":{"description":"If-Match is required."}}}},"/api/v1/cases/{caseId}/plans":{"get":{"summary":"List plans for a case","description":"Returns plans within an authorized case using opaque cursor pagination. Offset remains available only for compatibility and cannot be combined with cursor.","operationId":"listPartnerCasePlansV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"description":"Case identifier.","schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum items per page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor returned in pageInfo.nextCursor.","schema":{"type":"string"}},{"name":"offset","in":"query","deprecated":true,"description":"Compatibility offset. Do not combine with cursor.","schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Cursor-paginated case plans.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanListResponse"}}}},"400":{"description":"Invalid cursor or conflicting pagination modes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorErrorResponse"}}}},"401":{"description":"Authentication required."},"403":{"description":"The credential lacks plans:read or case access."},"404":{"description":"Case not found."}}},"post":{"summary":"Add a plan to a canonical case","operationId":"createPartnerCasePlanV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanWriteRequest"}}}},"responses":{"200":{"description":"Plan added and case version advanced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanWriteResponse"}}}},"409":{"description":"Plan ID already exists."},"412":{"description":"If-Match is stale."},"428":{"description":"If-Match is required."}}}},"/api/v1/cases/{caseId}/plans/batch":{"post":{"summary":"Atomically add multiple plans to a canonical case","description":"Validates every plan and duplicate identifier before committing the complete batch in one case revision. The operation is all-or-nothing and supports multiple plan and benefit types.","operationId":"createPartnerCasePlansBatchV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanBatchWriteRequest"}}}},"responses":{"200":{"description":"All plans added and one case version committed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanBatchWriteResponse"}}}},"409":{"description":"A plan ID already exists in the case or is duplicated within the batch."},"412":{"description":"If-Match is stale."},"422":{"description":"One or more plans are invalid."},"428":{"description":"If-Match is required."}}}},"/api/v1/cases/{caseId}/plans/{planId}":{"get":{"summary":"Get a plan from canonical case state","operationId":"getPartnerCasePlanV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Plan found.","content":{"application/json":{"schema":{"type":"object","required":["ok","plan"],"properties":{"ok":{"type":"boolean"},"plan":{"$ref":"#/components/schemas/Plan"}}}}}},"404":{"description":"Case or plan not found."}}},"put":{"summary":"Replace a plan","operationId":"replacePartnerCasePlanV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanWriteRequest"}}}},"responses":{"200":{"description":"Plan replaced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanWriteResponse"}}}},"404":{"description":"Case or plan not found."},"412":{"description":"If-Match is stale."},"428":{"description":"If-Match is required."}}},"patch":{"summary":"Merge-patch a plan","operationId":"patchPartnerCasePlanV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/merge-patch+json":{"schema":{"$ref":"#/components/schemas/CasePlanPatchRequest"}},"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanPatchRequest"}}}},"responses":{"200":{"description":"Plan patched.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CasePlanWriteResponse"}}}},"404":{"description":"Case or plan not found."},"412":{"description":"If-Match is stale."},"428":{"description":"If-Match is required."}}},"delete":{"summary":"Delete a plan","operationId":"deletePartnerCasePlanV1","x-api-lifecycle":"stable","tags":["Cases"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"caseId","in":"path","required":true,"schema":{"type":"string"}},{"name":"planId","in":"path","required":true,"schema":{"type":"string"}},{"name":"If-Match","in":"header","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Plan deleted and case version advanced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaseWriteResponse"}}}},"404":{"description":"Case or plan not found."},"412":{"description":"If-Match is stale."},"428":{"description":"If-Match is required."}}}},"/api/v1/plan-library":{"get":{"summary":"List plan library items for a partner integration","description":"Returns plan library items visible to the authenticated principal using opaque cursor pagination. Offset remains available only for compatibility and cannot be combined with cursor.","operationId":"listPartnerPlanLibraryV1","x-api-lifecycle":"stable","tags":["Plan Library"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","description":"Maximum items per page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","description":"Opaque cursor returned in pageInfo.nextCursor.","schema":{"type":"string"}},{"name":"offset","in":"query","description":"Compatibility offset. Do not combine with cursor.","schema":{"type":"integer","minimum":0},"deprecated":true},{"name":"orgId","in":"query","description":"Strict organization filter.","schema":{"type":"string"}},{"name":"search","in":"query","description":"Search plan name and carrier.","schema":{"type":"string"}},{"name":"platform","in":"query","description":"Platform metadata filter.","schema":{"type":"string"}},{"name":"carrier","in":"query","description":"Exact carrier filter.","schema":{"type":"string"}},{"name":"planType","in":"query","description":"Benefit or plan-type filter.","schema":{"type":"string"}},{"name":"dateRange","in":"query","description":"Updated-date range.","schema":{"type":"string","enum":["This Week","This Month","Last 3 Months","This Year"]}},{"name":"folderId","in":"query","description":"Folder UUID, 'null' for unfiled plans, or '*' for no folder filter.","schema":{"type":"string"}},{"name":"userEmail","in":"query","description":"Email fallback for API-key callers evaluating domain sharing.","schema":{"type":"string","format":"email"}}],"responses":{"200":{"description":"Cursor-paginated plan library items.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryCursorListResponse"}}}},"400":{"description":"Invalid cursor or conflicting pagination modes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorErrorResponse"}}}},"401":{"description":"Authentication required."},"403":{"description":"The credential lacks plans:read or organization access."},"404":{"description":"Folder not found."}}}},"/api/v1/assistant-work/file-steps/claim":{"post":{"operationId":"claimAssistantFileStep","summary":"Admit one scoped QCC preparation attempt","description":"Requires current Work version and reauthorized original sources. Existing or expired claims require owner reconciliation and are never automatically replayed.","tags":["Assistant"],"security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["workItemId","runId","stepId","planRevision","inputFingerprint","expectedVersion"],"properties":{"workItemId":{"type":"string","maxLength":160},"runId":{"type":"string","maxLength":160},"stepId":{"type":"string","enum":["parse"]},"planRevision":{"type":"integer","minimum":1},"inputFingerprint":{"type":"string","maxLength":160},"expectedVersion":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Admission or previous attempt to reconcile","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["success","admitted","attemptId"],"properties":{"success":{"type":"boolean"},"admitted":{"type":"boolean"},"checking":{"type":"boolean"},"attemptId":{"type":"string","maxLength":160},"ownerRef":{"type":"string","maxLength":160,"nullable":true}}}}}},"400":{"description":"Invalid step request"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Scope revoked"},"409":{"description":"Refresh the current work version"}}}},"/api/plan-library/facets":{"get":{"operationId":"getPlanLibraryFacets","summary":"Get authorized plan-library collection counts","description":"Returns collection counts over the caller-visible repository rows, without plan bodies. The optional organization must be a current membership. Requires plans:read for integration credentials.","tags":["Plan Library"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"orgId","in":"query","schema":{"type":"string"},"description":"Restrict counts to this authorized organization."},{"name":"ownership","in":"query","schema":{"type":"string","enum":["all","mine","shared"],"default":"all"}}],"responses":{"200":{"description":"Visibility-scoped counts; no plan bodies","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanLibraryFacetsResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Requested organization is not an authorized membership"},"500":{"description":"Facet aggregation failed"},"501":{"description":"Cloud SQL is disabled"}}}},"/api/v1/parse/unified/artifact":{"post":{"summary":"Parse a retained extracted artifact","description":"Uses the same durable DocumentParseService admission, authorization and idempotency owner as unified uploads, additionally allowing text/plain. Up to 50 MiB per upload. async=true returns a 202 receipt immediately; otherwise observation waits up to 45 seconds and returns a completed result or 202 for retained pending work. No case changes are applied. Integration credentials require any of cases:import, cases:write, pdf:extract or rate-sheets:write.","tags":["Parse"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"PDF, supported image, Office or CSV file, or text/plain extracted artifact; accepted formats share SourceDocumentService."},"forceParser":{"type":"string","description":"Force a specific parser ID (see /api/v1/parse/unified/parsers).","enum":["adp-totalsource","hris-paychex","aura-paychex","aetna-afa","benefit-guide","benefitter","uhc-quote","pdf-invoice","document-parser-sbc","ai-bedrock"]},"documentTypeHint":{"type":"string","description":"Hint to influence parser selection","enum":["sbc","quote","rates","invoice","renewal","level-funded","self-funded","self-insured","peo","not-specified"]},"benefitType":{"type":"string","description":"Benefit type, e.g. medical/dental/vision","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]},"maxAttempts":{"type":"integer","description":"Max parsers to try","default":5,"minimum":1,"maximum":20},"async":{"type":"boolean","description":"Force async processing"},"intent":{"type":"string","enum":["discover","ai_rescan","verify_fields"],"default":"discover"},"sourceRevision":{"type":"string","maxLength":160},"inventoryRevision":{"type":"string","maxLength":160},"fieldScope":{"type":"string","description":"JSON-encoded array of requested field identifiers."},"verification":{"type":"string","description":"JSON-encoded verification metadata."},"parseMode":{"type":"string","enum":["enhancement_patch"]},"additionalInstructions":{"type":"string"},"caseId":{"type":"string"}}}}}},"responses":{"200":{"description":"Synchronous parse result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"plans":{"type":"array","items":{"type":"object","description":"Parsed plan payload. Includes metadata flags: _unifiedPipeline, _parseSource, _serverParsed.","additionalProperties":true,"properties":{"_unifiedPipeline":{"type":"boolean","description":"True when produced by unified parser."},"_parseSource":{"type":"string","description":"Parser ID that produced this plan."},"_serverParsed":{"type":"boolean","description":"Indicates server-side parse."}}}},"source":{"type":"string"},"confidence":{"type":"number"},"attempts":{"type":"array","items":{"type":"object"}},"totalTimeMs":{"type":"integer"},"requestId":{"type":"string"}}},"examples":{"success":{"summary":"Parsed plans","value":{"ok":true,"source":"adp-totalsource","confidence":0.86,"totalTimeMs":2145,"requestId":"unified-1712345678-abcd1","attempts":[{"parserId":"adp-totalsource","success":true,"planCount":2,"timeMs":1800}],"plans":[{"planName":"ADP Gold PPO","benefits":{"deductible":"$1,500 / $3,000","oop":"$6,000 / $12,000"},"_unifiedPipeline":true,"_parseSource":"adp-totalsource","_serverParsed":true}]}}}}}},"202":{"description":"Durable parse operation accepted or still pending after observation.","headers":{"Location":{"description":"Canonical job status resource.","schema":{"type":"string"}},"Retry-After":{"description":"Recommended seconds before polling.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnifiedParseAcceptedOperation"}}}},"400":{"description":"Missing file or invalid parameters","content":{"application/json":{"examples":{"missingFile":{"summary":"No file provided","value":{"ok":false,"error":"No file provided","requestId":"unified-1712345678-abcd1"}},"unknownParser":{"summary":"Force parser not recognized","value":{"ok":false,"error":"Unknown parser: custom-parser","availableParsers":["adp-totalsource","hris-paychex","aura-paychex","aetna-afa","benefit-guide","benefitter","uhc-quote","pdf-invoice","document-parser-sbc","ai-bedrock"],"requestId":"unified-1712345678-abcd2"}},"tooLarge":{"summary":"File exceeds 50MB limit","value":{"ok":false,"error":"File too large (max 50MB)","requestId":"unified-1712345678-abcd3"}}}}}},"401":{"description":"Unauthorized"},"409":{"description":"Expired/unavailable continuation, changed source or inventory, unknown provider outcome, or incompatible operation contract"},"422":{"description":"Retained parse operation completed with failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"examples":{"queueFailure":{"summary":"Async queue failure","value":{"ok":false,"error":"queue_failed","message":"Failed to queue async job. Try sync mode instead.","requestId":"unified-1712345678-abcd4"}}}}}}},"operationId":"submitUnifiedParseArtifact"}},"/api/v1/parse/unified/jobs/{jobId}/events":{"get":{"operationId":"observeUnifiedParseJobEvents","summary":"Observe authorized parse progress as NDJSON","description":"Read-only observation of the existing job owner. Authorization runs before response headers and remains enforced during observation. One JSON event per line; this is application/x-ndjson, not SSE. A terminal event ends the stream. Disconnect stops observation and does not cancel or resume the job. Errors after headers are type:error events. Integration credentials may use cases:read, rate-sheets:read or any parse write scope.","tags":["Parse","Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier of a parse job owned by the authenticated user and selected organization."},{"name":"cursor","in":"query","schema":{"type":"integer","minimum":-1,"default":-1},"description":"Last observed event cursor; only newer events are emitted. Invalid cursors are reported through the observation error path."}],"responses":{"200":{"description":"Newline-delimited progress, terminal or error events","headers":{"Cache-Control":{"schema":{"type":"string"},"description":"private, no-store"}},"content":{"application/x-ndjson":{"schema":{"type":"string","description":"UTF-8 JSON objects separated by newline characters."},"x-event-schema":{"$ref":"#/components/schemas/UnifiedParseObservationEvent"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Scope, organization, feature policy or budget denies this operation"},"404":{"description":"Job is unknown or unavailable to this user and organization"},"500":{"description":"Observation or admission unavailable; retained operations remain available"}}}},"/api/v1/parse/unified/jobs/{jobId}/resume":{"post":{"operationId":"resumeUnifiedParseJob","summary":"Resume retained parse field verification","description":"Explicitly admits a bounded continuation from the authorized retained parent checkpoint. It does not accept replacement plans, source text or actor identity from the client. Source/inventory/digest mismatches, expired checkpoints, incompatible contracts and unknown provider outcomes prevent admission. The owner rechecks AI feature/budget policy. This may schedule billable provider work; observation alone never does. Integration credentials require any parse write scope.","tags":["Parse","Jobs"],"security":[{"bearerAuth":[]},{"apiKey":[]}],"parameters":[{"name":"jobId","in":"path","required":true,"schema":{"type":"string"},"description":"Identifier of a parse job owned by the authenticated user and selected organization."}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnifiedParseContinuationRequest"}}}},"responses":{"202":{"description":"Durable continuation accepted; this is not a completed parse or an applied case change.","headers":{"Location":{"description":"Canonical job status resource.","schema":{"type":"string"}},"Retry-After":{"description":"Recommended seconds before polling.","schema":{"type":"integer","minimum":1}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnifiedParseAcceptedOperation"}}}},"400":{"description":"Invalid parse request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"description":"Scope, organization, feature policy or budget denies this operation"},"404":{"description":"Job is unknown or unavailable to this user and organization"},"409":{"description":"Expired/unavailable continuation, changed source or inventory, unknown provider outcome, or incompatible operation contract"},"500":{"description":"Observation or admission unavailable; retained operations remain available"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT or opaque OAuth access token","description":"Cognito JWTs and Planlined OAuth access tokens. Include as Authorization: Bearer {token}."},"apiKey":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for server-to-server integrations. Generate keys in organization settings."},"magicSessionToken":{"type":"apiKey","in":"header","name":"X-Session-Token","description":"Opaque session token returned by POST /api/enrollment-portal/forms/{formId}/verify-magic. Bound to a single enrollment form; used by the employee-facing election submission endpoint."}},"parameters":{"IdempotencyKey":{"name":"X-Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":255},"description":"Unique key for idempotent request processing. When provided, ensures at-most-once execution. If a request with the same key was already processed, returns the cached response with X-Idempotency-Replayed: true header.","example":"create-case-acme-2025-q1"}},"responses":{"Unauthorized":{"description":"Authentication required or token invalid","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"error":{"type":"string","example":"unauthorized"}}}}}},"BadRequest":{"description":"Bad Request - Invalid input parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"validation-error":{"summary":"Validation error","value":{"ok":false,"code":"VALIDATION_ERROR","message":"Invalid request parameters","details":{"field":"email","reason":"Invalid email format"},"requestId":"req_abc123xyz"}},"missing-field":{"summary":"Missing required field","value":{"ok":false,"code":"MISSING_FIELD","message":"Required field 'name' is missing","requestId":"req_def456uvw"}}}}}},"Forbidden":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"not-owner":{"summary":"Not resource owner","value":{"ok":false,"code":"FORBIDDEN","message":"You do not have permission to modify this resource","requestId":"req_ghi789rst"}},"org-access":{"summary":"Organization access denied","value":{"ok":false,"code":"ORG_ACCESS_DENIED","message":"You are not a member of this organization","requestId":"req_jkl012mno"}}}}}},"NotFound":{"description":"Not Found - Resource does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"case-not-found":{"summary":"Case not found","value":{"ok":false,"code":"NOT_FOUND","message":"Case not found","requestId":"req_pqr345stu"}},"plan-not-found":{"summary":"Plan library item not found","value":{"ok":false,"code":"NOT_FOUND","message":"Plan library item not found","requestId":"req_vwx678yza"}}}}}},"TooManyRequests":{"description":"Too Many Requests - Rate limit exceeded","headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in window","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in current window","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"rate-limited":{"summary":"Rate limit exceeded","value":{"ok":false,"code":"RATE_LIMIT_EXCEEDED","message":"Too many requests. Please retry after 60 seconds.","retryAfter":60,"requestId":"req_bcd901efg"}}}}}},"ServiceUnavailable":{"description":"Service Unavailable - Temporary outage","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"maintenance":{"summary":"Scheduled maintenance","value":{"ok":false,"code":"SERVICE_UNAVAILABLE","message":"Service temporarily unavailable for maintenance","retryAfter":300,"requestId":"req_hij234klm"}}}}}},"QuotaExceeded":{"description":"Quota Exceeded - Usage limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"parse-limit":{"summary":"Parse quota exceeded","value":{"ok":false,"code":"QUOTA_EXCEEDED","message":"Monthly parse limit exceeded","quota":{"type":"parse","used":100,"limit":100,"resetAt":"2025-02-01T00:00:00Z"},"requestId":"req_nop567qrs"}},"export-limit":{"summary":"Export quota exceeded","value":{"ok":false,"code":"QUOTA_EXCEEDED","message":"Monthly export limit exceeded","quota":{"type":"export","used":25,"limit":25,"resetAt":"2025-02-01T00:00:00Z"},"requestId":"req_tuv890wxy"}}}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"ok":false,"error":"internal_error","message":"An unexpected error occurred"}}}}},"schemas":{"PlanLibraryCollectionFacet":{"type":"object","required":["name","count","type"],"properties":{"name":{"type":"string"},"count":{"type":"integer","minimum":0},"type":{"type":"string","enum":["carrier","planType","platform","date"]}}},"PlanLibraryFacetsResponse":{"type":"object","required":["ok","total","collections","ownershipFilterApplied"],"properties":{"ok":{"type":"boolean","enum":[true]},"total":{"type":"integer","minimum":0},"ownershipFilterApplied":{"type":"boolean","enum":[true]},"collections":{"type":"object","required":["carriers","types","platforms","dates"],"properties":{"carriers":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryCollectionFacet"}},"types":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryCollectionFacet"}},"platforms":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryCollectionFacet"}},"dates":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryCollectionFacet"}}}}}},"UnifiedParseContinuationRequest":{"type":"object","description":"Optional bindings checked against the authorized retained parent. Client plan/text/identity fields never supply continuation content and are ignored.","properties":{"sourceRevision":{"oneOf":[{"type":"string","minLength":1,"maxLength":160},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}],"description":"Source or inventory revision, normalized to a trimmed string by the owner."},"inventoryRevision":{"oneOf":[{"type":"string","minLength":1,"maxLength":160},{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}],"description":"Source or inventory revision, normalized to a trimmed string by the owner."},"sourceDigest":{"type":"string","description":"Expected retained source digest; a mismatch returns 409."}},"additionalProperties":true},"UnifiedParseAcceptedOperation":{"allOf":[{"$ref":"#/components/schemas/AsyncJobSubmission"},{"type":"object","properties":{"operationId":{"type":"string"},"parseOperationId":{"type":"string"},"attemptId":{"type":"string"},"executionStatus":{"type":"string"},"sourceDigest":{"type":"string"},"sourceRevision":{"type":"string","nullable":true},"operationContract":{"type":"string"}}}]},"UnifiedParseObservationEvent":{"oneOf":[{"type":"object","required":["type","operationId","seq","cursor","provisional","status"],"properties":{"type":{"type":"string","enum":["progress","terminal"]},"operationId":{"type":"string"},"seq":{"type":"integer","minimum":0},"cursor":{"type":"integer","minimum":0},"provisional":{"type":"boolean"},"status":{"type":"string","enum":["queued","processing","completed","failed","cancelled","expired"]},"progress":{"type":"object","properties":{"stage":{"type":"string"},"label":{"type":"string"},"percent":{"type":"number"},"seq":{"type":"integer","minimum":0}},"additionalProperties":true},"result":{"type":"object","description":"The same authorized retained result available through the job status owner.","additionalProperties":true}},"additionalProperties":true},{"type":"object","required":["type","code"],"properties":{"type":{"type":"string","enum":["error"]},"code":{"type":"string"}},"additionalProperties":false}]},"Error":{"type":"object","description":"Standard error response format","required":["ok","code","message"],"properties":{"ok":{"type":"boolean","enum":[false],"description":"Always false for error responses"},"code":{"type":"string","description":"Machine-readable error code","enum":["VALIDATION_ERROR","MISSING_FIELD","INVALID_FORMAT","NOT_FOUND","FORBIDDEN","ORG_ACCESS_DENIED","UNAUTHORIZED","TOKEN_EXPIRED","RATE_LIMIT_EXCEEDED","QUOTA_EXCEEDED","SERVICE_UNAVAILABLE","INTERNAL_ERROR","PARSE_ERROR","EXPORT_ERROR","INTEGRATION_ERROR"]},"message":{"type":"string","description":"Human-readable error message"},"details":{"type":"object","description":"Additional error context (field-level errors, etc.)","additionalProperties":true},"requestId":{"type":"string","description":"Unique request identifier for debugging/support","pattern":"^req_[a-zA-Z0-9]+$","example":"req_abc123xyz"},"retryAfter":{"type":"integer","description":"Seconds to wait before retrying (for rate limits)","example":60},"quota":{"type":"object","description":"Quota details (for QUOTA_EXCEEDED errors)","properties":{"type":{"type":"string","description":"Resource type"},"used":{"type":"integer","description":"Amount/count used"},"limit":{"type":"integer","description":"Maximum limit"},"resetAt":{"type":"string","format":"date-time","description":"When quota/limit resets"}}}},"example":{"ok":false,"code":"VALIDATION_ERROR","message":"Invalid request parameters","requestId":"req_abc123xyz"}},"ErrorResponse":{"type":"object","description":"Standard API error response","properties":{"ok":{"type":"boolean","enum":[false],"description":"Always false for error responses"},"error":{"type":"string","description":"Error message or code"},"message":{"type":"string","description":"Human-readable error description"},"code":{"type":"string","description":"Machine-readable error code"},"details":{"type":"object","description":"Additional error context","additionalProperties":true}},"required":["ok","error"]},"IntegrationWorkflowCapability":{"type":"object","additionalProperties":false,"required":["endpoint","authScope"],"properties":{"endpoint":{"type":"string","description":"Relative API endpoint for the workflow"},"compatibilityEndpoint":{"type":"string","description":"Legacy compatibility endpoint retained while integrations migrate."},"statusEndpoint":{"type":"string","description":"Durable workflow-resource status endpoint template."},"authScope":{"type":"string","description":"Runtime resource scope required by the workflow"},"parserMode":{"type":"string"},"modes":{"type":"array","items":{"type":"string"}},"reviewedCommitEndpoint":{"type":"string"},"asyncParseEndpoint":{"type":"string"},"asyncParseStatus":{"type":"string","description":"Legacy parser-specific status endpoint retained for compatibility."},"idempotencyHeader":{"type":"string","enum":["X-Idempotency-Key"]},"jobStatusEndpoint":{"type":"string","description":"Canonical job status endpoint template."},"jobResultEndpoint":{"type":"string","description":"Canonical completed-job result endpoint template."},"jobCancelEndpoint":{"type":"string","description":"Canonical job cancellation endpoint template; use DELETE."},"sourceDocumentRecovery":{"type":"string"}}},"IntegrationWorkflows":{"type":"object","additionalProperties":false,"required":["parse","caseImport","benefitGuide","proposalBookPdf","proposalBookXlsx"],"properties":{"parse":{"$ref":"#/components/schemas/IntegrationWorkflowCapability"},"caseImport":{"$ref":"#/components/schemas/IntegrationWorkflowCapability"},"benefitGuide":{"$ref":"#/components/schemas/IntegrationWorkflowCapability"},"proposalBookPdf":{"$ref":"#/components/schemas/IntegrationWorkflowCapability"},"proposalBookXlsx":{"$ref":"#/components/schemas/IntegrationWorkflowCapability"}}},"IntegrationRenderingCapability":{"type":"object","additionalProperties":false,"required":["mode","note"],"properties":{"mode":{"type":"string","enum":["artifact-input"]},"note":{"type":"string"}}},"IntegrationCapabilitiesResponse":{"type":"object","additionalProperties":false,"required":["ok","version","workflows","rendering"],"properties":{"ok":{"type":"boolean","enum":[true]},"version":{"type":"string","enum":["v1"]},"workflows":{"$ref":"#/components/schemas/IntegrationWorkflows"},"rendering":{"$ref":"#/components/schemas/IntegrationRenderingCapability"}}},"BenefitGuidePublishResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","linkId","shortCode","shareUrl","shortUrl","kind","expiresAt"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"linkId":{"type":"string"},"shortCode":{"type":"string"},"shareUrl":{"type":"string","description":"Relative hosted guide path"},"shortUrl":{"type":"string","format":"uri"},"kind":{"type":"string","enum":["benefit-guide"]},"expiresAt":{"type":"string","format":"date-time"}}},"CaseMeta":{"type":"object","description":"Metadata for a benefit analysis case","properties":{"id":{"type":"string","description":"Unique case identifier","example":"case-acme-2025"},"userId":{"type":"string","description":"User ID of the case owner","example":"user_abc123"},"employerName":{"type":"string","description":"Name of the employer/company being analyzed","example":"Acme Corporation"},"policyPeriod":{"type":"string","description":"Policy period in MM/DD/YYYY - MM/DD/YYYY format","pattern":"^\\d{2}/\\d{2}/\\d{4} - \\d{2}/\\d{2}/\\d{4}$","example":"01/01/2025 - 12/31/2025"},"blobPath":{"type":"string","description":"Storage path for the full case data","example":"cases/user_abc123/case-acme-2025.json"},"planHash":{"type":"string","description":"Hash of plan data for change detection","example":"a1b2c3d4e5f6"},"createdAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of when the case was created"},"updatedAt":{"type":"string","format":"date-time","description":"ISO 8601 timestamp of last modification"},"updatedAtMs":{"type":"integer","format":"int64","description":"Unix timestamp in milliseconds of last modification"},"rowVersion":{"type":"integer","format":"int64","minimum":1,"description":"Monotonic optimistic-concurrency token returned as the ETag."},"tags":{"type":"array","description":"User-defined tags for organization","items":{"type":"string"},"example":["renewal","medical","priority"]},"orgId":{"type":"string","nullable":true,"description":"Organization ID if case belongs to an org"},"sharedOrgIds":{"type":"array","description":"Organizations this case is shared with","items":{"type":"string"}}},"example":{"id":"case-acme-2025","userId":"user_abc123","employerName":"Acme Corporation","policyPeriod":"01/01/2025 - 12/31/2025","createdAt":"2025-01-15T10:00:00Z","updatedAt":"2025-01-15T14:30:00Z","tags":["renewal","medical"]}},"CreateCaseWithReportRequest":{"type":"object","description":"Request body for creating a case with automatic report generation","required":["employerName"],"properties":{"id":{"type":"string","maxLength":100,"description":"Optional case ID. Auto-generated if not provided."},"employerName":{"type":"string","minLength":1,"maxLength":255,"description":"Employer/client name (required)"},"policyPeriod":{"type":"string","maxLength":100,"description":"Policy period (e.g., '01/01/2025 - 12/31/2025')"},"planData":{"$ref":"#/components/schemas/PlanData","description":"Plans organized by benefit type"},"enrollmentTiers":{"type":"array","description":"Enrollment tier definitions. Defaults to 4-tier if not provided.","items":{"$ref":"#/components/schemas/EnrollmentTier"}},"contributionSettings":{"$ref":"#/components/schemas/ContributionSettings","description":"Employer contribution configuration"},"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy","description":"Case-level proposal and funding decision state"},"employer":{"type":"object","description":"Additional employer information","properties":{"name":{"type":"string"},"address":{"type":"string"},"industry":{"type":"string"},"sicCode":{"type":"string"}}},"reportOptions":{"$ref":"#/components/schemas/ReportOptions","description":"Options for report generation"}}},"ReportOptions":{"type":"object","description":"Options for automatic report generation","properties":{"generateReport":{"type":"boolean","default":true,"description":"Whether to generate a shareable report. Set to false to create case only."},"benefitTypes":{"type":"array","items":{"type":"string"},"description":"Benefit types to include in report. Defaults to all types with plans."},"expirationDays":{"type":"integer","minimum":1,"maximum":365,"default":30,"description":"Days until report link expires"},"isLive":{"type":"boolean","default":false,"description":"If true, report auto-updates when case data changes"},"watermark":{"type":"object","properties":{"showWatermark":{"type":"boolean","default":false},"text":{"type":"string"}}},"branding":{"type":"object","properties":{"companyName":{"type":"string"},"logoUrl":{"type":"string","format":"uri"},"primaryColor":{"type":"string","description":"Hex color (e.g., '#1e40af')"}}}}},"CreateCaseWithReportResponse":{"type":"object","description":"Response from create-with-report endpoint","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"case":{"type":"object","properties":{"id":{"type":"string","description":"Case ID"},"employerName":{"type":"string"},"policyPeriod":{"type":"string","nullable":true},"blobPath":{"type":"string","description":"S3 path to case JSON"},"planHash":{"type":"string","description":"Hash for change detection"},"createdAt":{"type":"string","format":"date-time"},"reportTypes":{"type":"array","items":{"type":"string"},"description":"Benefit types with plans (e.g., ['medical', 'dental'])"},"planCount":{"type":"integer","description":"Total number of plans"}}},"report":{"type":"object","description":"Report generation result (only if generateReport was true)","properties":{"generated":{"type":"boolean","description":"Whether report was generated successfully"},"reportId":{"type":"string","description":"Unique report identifier"},"shareUrl":{"type":"string","format":"uri","description":"Public shareable URL"},"qrDataUrl":{"type":"string","description":"QR code as data URL (base64 PNG)"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"isLive":{"type":"boolean","description":"Whether report auto-updates"},"error":{"type":"string","description":"Error message if generation failed"}}},"durationMs":{"type":"integer","description":"Total processing time in milliseconds"}}},"CaseCreateRequest":{"type":"object","description":"Request body for creating or updating a case","properties":{"id":{"type":"string","description":"Case identifier. Auto-generated if not provided."},"employerName":{"type":"string","maxLength":255,"description":"Employer/client name"},"policyPeriod":{"type":"string","maxLength":100,"description":"Policy period"},"setupVersion":{"type":"string","enum":["1.0","1.1"],"description":"Use 1.1 for the versioned API. Versioned setup validates employerName, policyPeriod, reportTypes, and conditional PEO fields; omit only for legacy full-state saves."},"effectiveDate":{"type":"string","format":"date"},"renewalDate":{"type":"string","format":"date"},"orgId":{"type":"string","description":"Target organization. Must match the authenticated organization context."},"employerLocation":{"type":"object","additionalProperties":true,"description":"Employer city, state, ZIP, and industry captured in Step 1."},"reportTypes":{"type":"array","items":{"type":"string"}},"peoSetup":{"type":"object","properties":{"annualWages":{"type":"number","nullable":true},"totalEmployees":{"type":"number","nullable":true}},"additionalProperties":true},"themeSettings":{"type":"object","additionalProperties":true},"producer":{"type":"object","additionalProperties":true,"description":"Per-case producer snapshot. Organization profiles and logo uploads use their dedicated APIs."},"agency":{"type":"object","additionalProperties":true},"clientLogo":{"description":"Per-case client logo value or asset reference.","type":"string","nullable":true},"enrollmentSource":{"type":"string"},"censusData":{"type":"object","additionalProperties":true},"planLinks":{"type":"object","additionalProperties":true},"uiState":{"type":"object","additionalProperties":true},"rowVersion":{"type":"integer","format":"int64","minimum":1,"description":"Current case row version. Required for an update when If-Match is omitted."},"planData":{"$ref":"#/components/schemas/PlanData"},"enrollmentTiers":{"type":"array","description":"Enrollment tier definitions","items":{"$ref":"#/components/schemas/EnrollmentTier"}},"contributionSettings":{"$ref":"#/components/schemas/ContributionSettings"},"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy","description":"Case-level proposal and funding decision state"}},"additionalProperties":true},"VersionedCaseWriteRequest":{"allOf":[{"$ref":"#/components/schemas/CaseCreateRequest"},{"type":"object","required":["setupVersion","employerName","policyPeriod","reportTypes"],"properties":{"setupVersion":{"type":"string","enum":["1.1"]}}}]},"CaseReadResponse":{"type":"object","required":["ok","case"],"properties":{"ok":{"type":"boolean","enum":[true]},"case":{"$ref":"#/components/schemas/CaseData"}}},"CaseWriteResponse":{"type":"object","required":["ok","case","meta"],"properties":{"ok":{"type":"boolean","enum":[true]},"case":{"$ref":"#/components/schemas/CaseData"},"meta":{"type":"object","additionalProperties":true},"skipped":{"type":"string"},"warnings":{"type":"array","items":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"CasePlanWriteRequest":{"type":"object","required":["benefitType","type"],"properties":{"id":{"type":"string"},"planName":{"type":"string"},"name":{"type":"string"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]},"type":{"type":"string","enum":["current","proposed","renewal","alternate"]},"carrier":{"type":"string"},"rateStructure":{"type":"string"},"enrollmentAndRates":{"type":"object","additionalProperties":true},"benefits":{"type":"object","additionalProperties":true},"benefitIds":{"type":"object","additionalProperties":true}},"additionalProperties":true},"CasePlanWriteResponse":{"allOf":[{"$ref":"#/components/schemas/CaseWriteResponse"},{"type":"object","required":["plan"],"properties":{"plan":{"$ref":"#/components/schemas/Plan"}}}]},"CasePlanBatchWriteRequest":{"type":"object","required":["plans"],"additionalProperties":false,"properties":{"plans":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/CasePlanWriteRequest"}}}},"CasePlanBatchWriteResponse":{"allOf":[{"$ref":"#/components/schemas/CaseWriteResponse"},{"type":"object","required":["plans","atomic"],"properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}},"atomic":{"type":"boolean","enum":[true]}}}]},"CasePlanPatchRequest":{"type":"object","minProperties":1,"properties":{"planName":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"benefitType":{"type":"string","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]},"type":{"type":"string","enum":["current","proposed","renewal","alternate"]},"carrier":{"type":"string","nullable":true},"rateStructure":{"type":"string","nullable":true},"enrollmentAndRates":{"type":"object","nullable":true,"additionalProperties":true},"benefits":{"type":"object","nullable":true,"additionalProperties":true},"benefitIds":{"type":"object","nullable":true,"additionalProperties":true}},"additionalProperties":true},"CaseData":{"type":"object","description":"Full case data including all plans and settings","properties":{"id":{"type":"string","description":"Unique case identifier"},"employerName":{"type":"string","description":"Name of the employer/company being analyzed"},"policyPeriod":{"type":"string","description":"Policy effective period (MM/DD/YYYY - MM/DD/YYYY format)"},"setupVersion":{"type":"string","enum":["1.0","1.1"],"description":"Version of the validated case-setup contract used to create this state."},"effectiveDate":{"type":"string","format":"date"},"renewalDate":{"type":"string","format":"date"},"orgId":{"type":"string"},"employerLocation":{"type":"object","additionalProperties":true},"reportTypes":{"type":"array","items":{"type":"string"}},"peoSetup":{"type":"object","properties":{"annualWages":{"type":"number","nullable":true},"totalEmployees":{"type":"number","nullable":true}},"additionalProperties":true},"themeSettings":{"type":"object","additionalProperties":true},"producer":{"type":"object","additionalProperties":true},"agency":{"type":"object","additionalProperties":true},"clientLogo":{"type":"string","nullable":true},"enrollmentSource":{"type":"string"},"censusData":{"type":"object","additionalProperties":true},"planLinks":{"type":"object","additionalProperties":true},"uiState":{"type":"object","additionalProperties":true},"rowVersion":{"type":"integer","format":"int64","minimum":1,"description":"Current optimistic-concurrency token."},"planData":{"$ref":"#/components/schemas/PlanData","description":"Alternative structure for plan data by benefit type"},"enrollmentTiers":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentTier"},"description":"Available enrollment tier options for this case"},"contributionSettings":{"$ref":"#/components/schemas/ContributionSettings","description":"Employer contribution configuration"},"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy","description":"Case-level proposal and funding decision state"}},"additionalProperties":true},"PlanData":{"type":"object","description":"Plans organized by benefit type","properties":{"medical":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Medical benefit plans"},"dental":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Dental benefit plans"},"vision":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Vision benefit plans"},"life":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Life insurance plans"},"disability":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Disability insurance plans"},"self-insured":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Self-insured (ASO) alternative plans"},"peo":{"type":"array","items":{"$ref":"#/components/schemas/Plan"},"description":"Professional employer organization plans"}},"additionalProperties":{"type":"array","items":{"$ref":"#/components/schemas/Plan"}}},"SelfInsuredAdminFee":{"type":"object","description":"An itemized self-insured administrative fee. Amounts are source inputs, not derived totals.","properties":{"label":{"type":"string"},"amount":{"type":"number","nullable":true}},"additionalProperties":true},"SelfInsuredTerms":{"type":"object","description":"Optional self-insured stop-loss terms captured from a quote.","properties":{"specificDeductible":{"type":"number","nullable":true},"contractBasis":{"type":"string","nullable":true},"terminalLiability":{"type":"boolean","nullable":true},"aggregateCorridor":{"type":"number","nullable":true},"coveredLines":{"type":"array","items":{"type":"string"}},"thirdPartyAdministrator":{"type":"string","nullable":true},"laserLiability":{"type":"string","nullable":true}},"additionalProperties":true},"SelfInsuredFixedCosts":{"type":"object","description":"Optional fixed ASO cost-stack inputs. Derived annual totals are intentionally not required.","properties":{"adminPEPM":{"type":"array","items":{"$ref":"#/components/schemas/SelfInsuredAdminFee"}},"adminAnnualOverride":{"type":"number","nullable":true},"specificPremiumAnnual":{"type":"number","nullable":true},"specificPremiumPEPM":{"type":"number","nullable":true},"aggregatePremiumAnnual":{"type":"number","nullable":true},"aggregatePremiumPEPM":{"type":"number","nullable":true},"combinedStopLossAnnual":{"type":"number","nullable":true},"combinedStopLossPEPM":{"type":"number","nullable":true},"collateralAnnual":{"type":"number","nullable":true}},"additionalProperties":true},"SelfInsuredClaims":{"type":"object","description":"Optional ASO claims projections. Missing claims remain omitted and unavailable, not zero.","properties":{"expectedAnnual":{"type":"number","nullable":true},"expectedPEPM":{"type":"number","nullable":true},"maximumAnnual":{"type":"number","nullable":true},"maximumPEPM":{"type":"number","nullable":true},"rebatesAnnual":{"type":"number","nullable":true},"aggregateFactorsByTier":{"type":"object","additionalProperties":{"type":"number","nullable":true}}},"additionalProperties":true},"SelfInsuredPlanData":{"type":"object","description":"Persisted self-insured (ASO) source inputs. Derived totals and availability are calculated on read.","properties":{"terms":{"$ref":"#/components/schemas/SelfInsuredTerms"},"fixed":{"$ref":"#/components/schemas/SelfInsuredFixedCosts"},"claims":{"$ref":"#/components/schemas/SelfInsuredClaims"},"tierFactors":{"type":"object","additionalProperties":{"type":"number","nullable":true}}},"additionalProperties":true,"x-examples":[{"terms":{"specificDeductible":75000,"contractBasis":"12/12","coveredLines":["medical","rx"]},"fixed":{"adminPEPM":[{"label":"TPA","amount":55}],"specificPremiumAnnual":120000,"aggregatePremiumAnnual":48000,"collateralAnnual":25000},"claims":{"expectedAnnual":1450000,"maximumAnnual":1850000,"rebatesAnnual":60000}}]},"PeoVendorMeta":{"type":"object","properties":{"vendorName":{"type":"string","nullable":true},"hqState":{"type":"string","nullable":true},"yearsInBusiness":{"type":"number","nullable":true},"publicPrivate":{"type":"string","nullable":true},"sizeWorksiteEmployees":{"type":"number","nullable":true},"technologyPlatform":{"type":"string","nullable":true},"clientRetentionRate":{"type":"number","nullable":true},"accreditations":{"type":"array","items":{"type":"string"}},"differentiators":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"PeoServiceFee":{"type":"object","properties":{"scenario":{"type":"string","nullable":true},"totalPercentOfPayroll":{"type":"number","nullable":true},"totalMonthly":{"type":"number","nullable":true},"totalAnnual":{"type":"number","nullable":true},"subAllocations":{"type":"object","additionalProperties":{"type":"number","nullable":true}},"scenarios":{"type":"array","items":{"type":"object","additionalProperties":true}}},"additionalProperties":true},"PeoSource":{"type":"object","description":"Optional provenance for quoted or billed PEO economics.","properties":{"basis":{"type":"string","enum":["quoted","billed"]},"method":{"type":"string","enum":["deterministic","ai","hybrid"]},"carrier":{"type":"string"},"docIntent":{"type":"string","enum":["proposal","billing"]},"period":{"type":"object","properties":{"kind":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"}},"additionalProperties":true},"grossPayrollBasis":{"type":"number","nullable":true},"billedTotals":{"type":"object","additionalProperties":{"type":"number","nullable":true}},"derived":{"type":"boolean"}},"additionalProperties":true},"PeoPayroll":{"type":"object","properties":{"annualTotal":{"type":"number","nullable":true},"payFrequency":{"type":"string","enum":["monthly","semimonthly","biweekly","weekly"]},"employeeCount":{"type":"number","nullable":true},"percentBase":{"type":"string","nullable":true},"taxableAnnual":{"type":"number","nullable":true},"employeeWages":{"type":"array","items":{"type":"object","additionalProperties":true}},"notes":{"type":"string","nullable":true}},"additionalProperties":true},"PeoTaxes":{"type":"object","properties":{"ficaSSRate":{"type":"number","nullable":true},"ficaSSWageBase":{"type":"number","nullable":true},"ficaMedicareRate":{"type":"number","nullable":true},"futaRate":{"type":"number","nullable":true},"futaWageBase":{"type":"number","nullable":true},"sutaRate":{"type":"number","nullable":true},"sutaWageBase":{"type":"number","nullable":true},"state":{"type":"string","nullable":true},"calcMode":{"type":"string","nullable":true},"manualTotals":{"type":"object","additionalProperties":{"type":"number","nullable":true}}},"additionalProperties":true},"PeoWorkersComp":{"type":"object","properties":{"ratePer100Payroll":{"type":"number","nullable":true},"percentOfPayroll":{"type":"number","nullable":true},"manualTotal":{"type":"number","nullable":true}},"additionalProperties":true},"PeoAdminFees":{"type":"object","properties":{"pmpm":{"type":"number","nullable":true},"percentOfPayroll":{"type":"number","nullable":true},"perCheck":{"type":"number","nullable":true},"monthly":{"type":"number","nullable":true},"setupFee":{"type":"number","nullable":true}},"additionalProperties":true},"PeoEpli":{"type":"object","properties":{"annual":{"type":"number","nullable":true},"pmpm":{"type":"number","nullable":true}},"additionalProperties":true},"PeoPlanData":{"type":"object","description":"Persisted PEO source economics. The calculated section is a read-only compatibility snapshot and is not required input.","properties":{"pricingModel":{"type":"string","enum":["auto","itemized","composite"]},"payroll":{"$ref":"#/components/schemas/PeoPayroll"},"taxes":{"$ref":"#/components/schemas/PeoTaxes"},"workersComp":{"$ref":"#/components/schemas/PeoWorkersComp"},"adminFees":{"$ref":"#/components/schemas/PeoAdminFees"},"epli":{"$ref":"#/components/schemas/PeoEpli"},"serviceFee":{"$ref":"#/components/schemas/PeoServiceFee"},"medicalLink":{"type":"object","additionalProperties":true},"vendorMeta":{"$ref":"#/components/schemas/PeoVendorMeta"},"source":{"$ref":"#/components/schemas/PeoSource"},"calculated":{"type":"object","description":"Derived at read time; clients should not require or edit this object.","additionalProperties":true}},"additionalProperties":true,"x-examples":[{"pricingModel":"composite","serviceFee":{"scenario":"Base","totalPercentOfPayroll":0.0325,"subAllocations":{"payrollTaxes":0.012,"wcAndEpli":0.0045,"benefits":0.01,"coEmploymentRisk":0.002,"hrAdmin":0.004}},"payroll":{"annualTotal":2400000,"employeeCount":42},"source":{"basis":"quoted","method":"deterministic","carrier":"example-peo","docIntent":"proposal","derived":false}}]},"FundingDecision":{"type":"object","description":"Optional explicit fully-insured versus self-insured funding choices. Empty values preserve legacy cases.","properties":{"currentFunding":{"type":"string","enum":["","fully-insured","self-insured"]},"currentSelfInsuredPlanId":{"type":"string"},"recommendedFunding":{"type":"string","enum":["","fully-insured","self-insured"]},"recommendedSelfInsuredPlanId":{"type":"string"},"comparisonMedicalPlanId":{"type":"string"}},"additionalProperties":true},"ProposalStrategy":{"type":"object","description":"Case-level proposal narrative and optional funding decision.","properties":{"objective":{"type":"string"},"rationale":{"type":"string"},"tradeoffs":{"type":"string"},"financialSummary":{"type":"string"},"financialsDetailMode":{"type":"string","enum":["summary","allocation","both"]},"recommendationConfirmed":{"type":"boolean"},"draftMeta":{"type":"object","nullable":true,"additionalProperties":true},"assumptions":{"type":"object","additionalProperties":true},"contributionScenarioIds":{"type":"object","additionalProperties":{"type":"string"}},"highlightedStrategyKey":{"type":"string"},"scenarioSheetId":{"type":"string"},"reviewFingerprint":{"type":"string","nullable":true},"reviewInvalidatedAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true},"fundingDecision":{"$ref":"#/components/schemas/FundingDecision"}},"additionalProperties":true},"Plan":{"type":"object","description":"Individual benefit plan. Supports medical, dental, vision, self-insured ASO, PEO, and life/std/ltd plans.","required":["id","type","benefitType"],"properties":{"id":{"type":"string","description":"Unique plan identifier within the case"},"type":{"type":"string","enum":["current","proposed","renewal","alternate"],"description":"Whether this is a current, proposed, or renewal plan"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"],"description":"Type of benefit"},"planName":{"type":"string","description":"Display name of the plan"},"carrier":{"type":"string","description":"Insurance carrier name"},"rateStructure":{"type":"string","enum":["composite","age-rated","age-banded","volume"],"description":"Rate structure type. Use 'volume' for life/std/ltd plans."},"fundingType":{"type":"string","enum":["fully-insured","self-funded","level-funded","self-insured"],"description":"Plan funding type"},"mapsToPlanId":{"type":"string","nullable":true,"description":"For proposed plans, the ID of the current plan it replaces"},"policyNumber":{"type":"string","nullable":true,"description":"Insurance policy number"},"groupNumber":{"type":"string","nullable":true,"description":"Group number for the plan"},"benefitPlanId":{"type":"string","nullable":true,"description":"Carrier's benefit plan identifier"},"benefitIds":{"type":"object","nullable":true,"description":"Map of benefit field IDs to their carrier-specific identifiers. Used for linking parsed benefits to canonical fields.","additionalProperties":{"type":"string"},"example":{"deductible":"BEN-001","oop":"BEN-002"}},"identifiers":{"type":"object","nullable":true,"description":"Alias for benefitIds - carrier-specific benefit identifiers","additionalProperties":{"type":"string"}},"enrollmentAndRates":{"$ref":"#/components/schemas/EnrollmentAndRates","description":"Enrollment counts and rates by tier (for composite/age-banded plans)"},"members":{"type":"array","description":"Quoted member or contract premiums. Component households require identities, consistent elected tiers, exactly one employee, and explicit enrollment counting distinct contracts.","items":{"$ref":"#/components/schemas/AgeRatedMember"}},"ageRateTable":{"type":"array","description":"Age-banded rate table. Each entry maps an age range to a rate.","items":{"$ref":"#/components/schemas/AgeRateEntry"}},"volumeConfig":{"$ref":"#/components/schemas/VolumeConfig","description":"Volume-based configuration for life/std/ltd plans"},"benefits":{"$ref":"#/components/schemas/Benefits","description":"Plan benefit details (deductibles, copays, etc.)"},"isHSAEligible":{"type":"boolean","description":"Whether the plan is HSA-eligible (HDHP)"},"networkType":{"type":"string","description":"Network type (e.g., PPO, HMO, EPO, POS)"},"sourceDocumentId":{"type":"string","nullable":true,"description":"ID of the source document this plan was parsed from"},"sourceDocumentS3Key":{"type":"string","nullable":true,"description":"S3 key of the source document"},"si":{"$ref":"#/components/schemas/SelfInsuredPlanData","description":"Optional self-insured (ASO) cost-stack inputs; derived totals are not persisted."},"peo":{"$ref":"#/components/schemas/PeoPlanData","description":"Optional PEO economics inputs; calculated totals are derived at read time."},"enrollment":{"type":"object","description":"Distinct contract counts by elected tier. Required for component-member rosters and reconciled against the complete household roster. Covered people are not subscriber enrollment.","properties":{"employee":{"type":"integer","minimum":0},"spouse":{"type":"integer","minimum":0},"child":{"type":"integer","minimum":0},"family":{"type":"integer","minimum":0}},"required":["employee","spouse","child","family"]}},"example":{"id":"plan-med-001","type":"current","benefitType":"medical","planName":"PPO Gold","carrier":"Aetna","rateStructure":"composite","policyNumber":"POL-12345","groupNumber":"GRP-67890","enrollmentAndRates":{"employee":{"enrolled":50,"rate":650},"employeeSpouse":{"enrolled":20,"rate":1200},"employeeChildren":{"enrolled":15,"rate":1100},"family":{"enrolled":30,"rate":1800}}},"x-examples":{"completeSelfInsured":{"summary":"Complete self-insured ASO option","value":{"id":"plan-aso-001","type":"alternate","benefitType":"self-insured","planName":"ASO 75K Specific","fundingType":"self-insured","enrollmentAndRates":{"employee":{"enrolled":42,"rate":186.5}},"si":{"terms":{"specificDeductible":75000,"contractBasis":"12/12"},"fixed":{"adminPEPM":[{"label":"TPA","amount":55}],"specificPremiumAnnual":120000,"aggregatePremiumAnnual":48000},"claims":{"expectedAnnual":1450000,"maximumAnnual":1850000}}}},"incompleteSelfInsured":{"summary":"Incomplete self-insured option with omitted claims","value":{"id":"plan-aso-002","type":"alternate","benefitType":"self-insured","planName":"ASO pending claims","fundingType":"self-insured","si":{"fixed":{"adminPEPM":[{"label":"TPA","amount":55}]}}}},"peoCompositeServiceFee":{"summary":"PEO composite service-fee option","value":{"id":"plan-peo-001","type":"proposed","benefitType":"peo","planName":"Example PEO","peo":{"pricingModel":"composite","payroll":{"annualTotal":2400000,"employeeCount":42},"serviceFee":{"totalPercentOfPayroll":0.0325,"subAllocations":{"payrollTaxes":0.012,"wcAndEpli":0.0045,"benefits":0.01,"coEmploymentRisk":0.002,"hrAdmin":0.004}}}}}}},"AgeRatedMember":{"type":"object","description":"Priced member or whole-contract row for an age-rated plan. Member components share a contractId and elected coverageTier, identify relationships and require exactly one employee per household. Do not overlap whole-contract and component premiums.","properties":{"memberId":{"type":"string","description":"Unique member identifier"},"name":{"type":"string","description":"Member name (optional)"},"age":{"type":"integer","minimum":0,"maximum":120,"description":"Member age"},"dob":{"type":"string","format":"date","description":"Date of birth (YYYY-MM-DD)"},"relationship":{"type":"string","enum":["employee","spouse","child","dependent"],"description":"Relationship to subscriber"},"tier":{"type":"string","description":"Coverage tier (employee, employeeSpouse, etc.)"},"rate":{"type":"number","minimum":0,"description":"Individual monthly premium rate"},"subscriberId":{"type":"string","description":"ID of the subscriber (for dependents)"},"id":{"type":"string","description":"Stable unique priced-row ID. Distinct from household identity."},"cost":{"type":"number","minimum":0,"description":"Actual quoted total monthly premium for this person or contract, including employer and employee shares."},"coverageTier":{"type":"string","enum":["EE","ES","EC","FM"],"description":"Elected household coverage, shared by every member in that contract. Relationship is a separate fact."},"premiumUnit":{"type":"string","enum":["member","contract"],"description":"member prices one person; contract prices the entire household. Never overlap within a household."},"contractId":{"type":"string","minLength":1,"description":"Actual household contract identity, shared by employee and dependents. Required for component-member premiums."}},"example":{"id":"member-001","contractId":"household-001","age":35,"relationship":"employee","coverageTier":"ES","premiumUnit":"member","cost":425.5}},"AgeRateEntry":{"type":"object","description":"Age-banded rate table entry","properties":{"ageMin":{"type":"integer","description":"Minimum age for this band"},"ageMax":{"type":"integer","description":"Maximum age for this band"},"rate":{"type":"number","description":"Monthly rate for this age band"},"tier":{"type":"string","description":"Optional tier qualifier (if rates vary by tier within age band)"}},"example":{"ageMin":30,"ageMax":34,"rate":385}},"VolumeConfig":{"type":"object","description":"Configuration for volume-based plans (life, std, ltd)","properties":{"numberOfCovered":{"type":"integer","minimum":0,"description":"Number of covered employees"},"volumeAmount":{"type":"number","description":"Total coverage volume amount (e.g., total life insurance coverage)"},"maxBenefit":{"type":"number","description":"Maximum benefit amount"},"ratePerUnit":{"type":"number","description":"Rate per unit (per $1,000 for life, per $100 for LTD, per $10 for STD)"},"rateLabel":{"type":"string","description":"Label describing the rate unit (e.g., 'per $1,000')"},"rateDivisor":{"type":"integer","enum":[10,100,1000],"description":"Divisor for rate calculation (10 for STD, 100 for LTD, 1000 for life)"},"adnd":{"type":"boolean","description":"Whether AD&D coverage is included (life plans)"},"benefitPercent":{"type":"string","description":"Benefit percentage of salary (std/ltd plans, e.g., '60%')"},"maxWeeklyBenefit":{"type":"number","description":"Maximum weekly benefit (STD plans)"},"maxMonthlyBenefit":{"type":"number","description":"Maximum monthly benefit (LTD plans)"},"eliminationPeriod":{"type":"string","description":"Elimination/waiting period (e.g., '7/7 days', '90 days')"},"benefitDuration":{"type":"string","description":"Maximum benefit duration (e.g., '13 weeks', 'To age 65')"}},"example":{"numberOfCovered":80,"volumeAmount":4000000,"maxBenefit":100000,"ratePerUnit":0.15,"rateLabel":"per $1,000","rateDivisor":1000,"adnd":true}},"EnrollmentAndRates":{"type":"object","description":"Enrollment counts and premium rates by tier. Supports standard 4-tier structure (employee, employee+spouse, employee+children, family) as well as 2-tier and 3-tier structures.","properties":{"employee":{"$ref":"#/components/schemas/TierData","description":"Employee-only tier (single coverage)"},"employeeSpouse":{"$ref":"#/components/schemas/TierData","description":"Employee + Spouse tier"},"employeeChildren":{"$ref":"#/components/schemas/TierData","description":"Employee + Child(ren) tier"},"family":{"$ref":"#/components/schemas/TierData","description":"Family tier (employee + spouse + children)"}},"additionalProperties":{"$ref":"#/components/schemas/TierData"},"example":{"employee":{"enrolled":50,"rate":650},"employeeSpouse":{"enrolled":20,"rate":1200},"employeeChildren":{"enrolled":15,"rate":1100},"family":{"enrolled":30,"rate":1800}}},"TierData":{"type":"object","description":"Enrollment and rate data for a single tier","properties":{"enrolled":{"type":"integer","minimum":0,"description":"Number of enrolled members in this tier"},"rate":{"type":"number","minimum":0,"description":"Monthly premium rate for this tier"},"erContribution":{"type":"number","minimum":0,"description":"Employer contribution amount (calculated)"},"eeContribution":{"type":"number","minimum":0,"description":"Employee contribution amount (calculated)"}},"example":{"enrolled":50,"rate":650}},"Benefits":{"type":"object","description":"Plan benefit details. Keys are canonical benefit IDs that vary by benefit type. See BenefitIdReference for complete list per benefit type.","additionalProperties":{"$ref":"#/components/schemas/BenefitValue"},"example":{"deductible":{"value":"$1,500 / $3,000"},"coinsurance":{"value":"20%"},"oop":{"value":"$6,000 / $12,000"},"pcp":{"value":"$25"},"specialist":{"value":"$50"},"er":{"value":"$250"}}},"BenefitValue":{"type":"object","description":"Parsed benefit value with optional confidence score.","properties":{"value":{"type":"string","description":"The value"},"confidence":{"type":"string","enum":["high","medium","low"],"description":"Confidence score (0-1)"},"rawConfidence":{"type":"number","description":"Raw confidence score from extraction"}},"additionalProperties":true},"BenefitIdReference":{"type":"object","description":"Reference documentation for canonical benefit IDs by benefit type. Use these IDs as keys in the benefits object.","properties":{"medical":{"type":"object","description":"Medical plan benefit IDs","properties":{"deductible":{"type":"string","description":"In-network deductible (Ind / Fam format supported)"},"deductible-fam":{"type":"string","description":"Family deductible (when stored separately)"},"ded-oon":{"type":"string","description":"Out-of-network deductible"},"ded-oon-fam":{"type":"string","description":"Out-of-network family deductible"},"oop":{"type":"string","description":"Out-of-pocket maximum (Ind / Fam format supported)"},"oop-fam":{"type":"string","description":"Family OOP max (when stored separately)"},"oop-oon":{"type":"string","description":"Out-of-network OOP maximum"},"oop-oon-fam":{"type":"string","description":"Out-of-network family OOP maximum"},"coinsurance":{"type":"string","description":"Coinsurance percentage (e.g., '20%')"},"coins-oon":{"type":"string","description":"Out-of-network coinsurance"},"pcp":{"type":"string","description":"Primary care physician copay"},"specialist":{"type":"string","description":"Specialist visit copay"},"urgent":{"type":"string","description":"Urgent care copay"},"er":{"type":"string","description":"Emergency room copay"},"hospital":{"type":"string","description":"Hospital/inpatient copay or coinsurance"},"outpatient-surgery":{"type":"string","description":"Outpatient surgery copay"},"lab":{"type":"string","description":"Laboratory services"},"imaging":{"type":"string","description":"Imaging (X-Ray/MRI/CT)"},"rx-ded":{"type":"string","description":"Prescription drug deductible"},"rx-card":{"type":"string","description":"RX coverage summary (Tier1/Tier2/Tier3 format)"},"rx-generic":{"type":"string","description":"Generic drug copay"},"rx-brand":{"type":"string","description":"Brand drug copay"},"rx-specialty":{"type":"string","description":"Specialty drug copay"},"preventive":{"type":"string","description":"Preventive care coverage"},"mental":{"type":"string","description":"Mental health coverage"},"telehealth":{"type":"string","description":"Telehealth/virtual visit copay"}}},"dental":{"type":"object","description":"Dental plan benefit IDs","properties":{"dental-annual-max":{"type":"string","description":"Annual maximum benefit"},"dental-deductible":{"type":"string","description":"In-network deductible"},"dental-deductible-oon":{"type":"string","description":"Out-of-network deductible"},"dental-preventive":{"type":"string","description":"Preventive/Type I coverage (e.g., '100%')"},"dental-basic":{"type":"string","description":"Basic/Type II coverage (e.g., '80%')"},"dental-major":{"type":"string","description":"Major/Type III coverage (e.g., '50%')"},"dental-implants":{"type":"string","description":"Implant coverage"},"dental-ortho":{"type":"string","description":"Orthodontia coverage percentage"},"dental-ortho-max":{"type":"string","description":"Orthodontia lifetime maximum"},"dental-ortho-age":{"type":"string","description":"Orthodontia age limit"},"dental-waiting-basic":{"type":"string","description":"Basic services waiting period"},"dental-waiting-major":{"type":"string","description":"Major services waiting period"}}},"vision":{"type":"object","description":"Vision plan benefit IDs","properties":{"vision-exam":{"type":"string","description":"Eye exam copay"},"vision-exam-frequency":{"type":"string","description":"Exam frequency (e.g., '12 months')"},"vision-frames":{"type":"string","description":"Frames allowance"},"vision-frames-frequency":{"type":"string","description":"Frames frequency (e.g., '24 months')"},"vision-lenses":{"type":"string","description":"Lenses coverage"},"vision-contacts":{"type":"string","description":"Contact lens allowance"},"vision-contacts-frequency":{"type":"string","description":"Contacts frequency"},"vision-lasik":{"type":"string","description":"LASIK discount"}}},"life":{"type":"object","description":"Life insurance benefit IDs","properties":{"life-benefit-amount":{"type":"string","description":"Benefit amount (flat or formula)"},"life-benefit-multiple":{"type":"string","description":"Salary multiple (e.g., '1x', '2x')"},"life-gi-amount":{"type":"string","description":"Guaranteed issue amount"},"life-max-benefit":{"type":"string","description":"Maximum benefit cap"},"life-rate-per-thousand":{"type":"string","description":"Rate per $1,000 of coverage"},"life-ad-d":{"type":"string","description":"AD&D coverage included"},"life-dependent-spouse":{"type":"string","description":"Spouse coverage amount"},"life-dependent-child":{"type":"string","description":"Child coverage amount"},"life-age-reduction":{"type":"string","description":"Age reduction schedule"},"life-portability":{"type":"string","description":"Portability availability"}}},"std":{"type":"object","description":"Short-term disability benefit IDs","properties":{"std-benefit-pct":{"type":"string","description":"Benefit percentage (e.g., '60%')"},"std-weekly-max":{"type":"string","description":"Maximum weekly benefit"},"std-elim-accident":{"type":"string","description":"Elimination period for accidents"},"std-elim-sickness":{"type":"string","description":"Elimination period for sickness"},"std-max-duration":{"type":"string","description":"Maximum benefit duration"},"std-pre-existing":{"type":"string","description":"Pre-existing condition waiting period"},"std-definition":{"type":"string","description":"Disability definition"}}},"ltd":{"type":"object","description":"Long-term disability benefit IDs","properties":{"ltd-benefit-pct":{"type":"string","description":"Benefit percentage (e.g., '60%')"},"ltd-monthly-max":{"type":"string","description":"Maximum monthly benefit"},"ltd-elim-period":{"type":"string","description":"Elimination period (e.g., '90 days')"},"ltd-max-duration":{"type":"string","description":"Maximum benefit duration (e.g., 'To age 65')"},"ltd-definition":{"type":"string","description":"Disability definition (own occ/any occ)"},"ltd-cola":{"type":"string","description":"Cost of living adjustment"},"ltd-own-occ-period":{"type":"string","description":"Own occupation period"},"ltd-offsets":{"type":"string","description":"Benefit offsets (Social Security, etc.)"}}}}},"EnrollmentTier":{"type":"object","description":"Enrollment tier definition","required":["id","label"],"properties":{"id":{"type":"string","description":"Tier identifier (e.g., 'employee', 'family')"},"label":{"type":"string","description":"Display label (e.g., 'Employee Only', 'Family')"}},"example":{"id":"employee","label":"Employee Only"}},"ContributionSettings":{"type":"object","description":"Employer contribution configuration","properties":{"isEnabled":{"type":"boolean","description":"Whether contributions are configured"},"frequency":{"type":"integer","enum":[12,24,26,52],"description":"Pay periods per year"},"modelType":{"type":"string","enum":["flat","tiered","percentage"],"description":"Contribution model type"},"models":{"type":"object","description":"Contribution models by plan or global"}}},"PlanLibraryItem":{"type":"object","description":"Plan library item","properties":{"id":{"type":"string","description":"Unique library item identifier"},"name":{"type":"string","description":"Display name for the template"},"category":{"type":"string","nullable":true,"description":"Benefit category (medical, dental, vision, etc.)"},"metadata":{"type":"object","nullable":true,"description":"Additional item metadata","additionalProperties":true},"plan":{"type":"object","nullable":true,"description":"The plan template data","additionalProperties":true},"orgId":{"type":"string","nullable":true,"description":"Organization this item belongs to"},"visibility":{"type":"string","enum":["private","org","public","shared"],"description":"Who can access this item (private, org, shared)"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp","nullable":true},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp","nullable":true},"userId":{"type":"string","nullable":true,"description":"Owning user identifier."},"plan_folder_id":{"type":"string","nullable":true,"description":"Plan folder assignment."},"rowVersion":{"type":"integer","format":"int64","minimum":1,"description":"Monotonic concurrency token for this Plan Library item."}},"required":["id","name","visibility"]},"PlanLibraryItemCreate":{"type":"object","description":"Request body for creating/updating plan library item","properties":{"name":{"type":"string","description":"Item name"},"category":{"type":"string","nullable":true,"description":"Category (e.g., 'medical', 'dental')"},"metadata":{"type":"object","nullable":true,"description":"Additional metadata","additionalProperties":true},"plan":{"type":"object","nullable":true,"description":"Plan data object","additionalProperties":true},"orgId":{"type":"string","nullable":true,"description":"Organization ID for scoping"},"visibility":{"type":"string","enum":["private","org","public"],"default":"private","description":"Visibility setting (private, org, shared)"},"plan_folder_id":{"type":"string","nullable":true},"originatingCaseId":{"type":"string"},"originatingCaseName":{"type":"string"},"expectedVersion":{"type":"integer","format":"int64","minimum":1,"description":"Optional rowVersion expected by an update. A stale value returns HTTP 412."}},"required":["name"]},"PlanTemplate":{"type":"object","description":"Organization-level plan template","properties":{"id":{"type":"string","description":"Unique identifier"},"orgId":{"type":"string","description":"Associated organization ID"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"data":{"type":"object","description":"Template plan data"},"isDefault":{"type":"boolean","description":"Whether this is the default template"},"createdBy":{"type":"string","description":"User ID who created this resource"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp (ISO 8601)"}}},"PlanTemplateCreate":{"type":"object","description":"Request body for creating/updating plan template","properties":{"name":{"type":"string","description":"Template name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"data":{"type":"object","description":"Template plan data"},"isDefault":{"type":"boolean","default":false,"description":"Whether this is the default template"}},"required":["name","data"]},"ContributionTemplate":{"type":"object","description":"Contribution configuration template","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"orgId":{"type":"string","nullable":true,"description":"Organization id for organization-scoped templates"},"visibility":{"type":"string","enum":["private","organization","public"],"description":"Template sharing scope"},"category":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"template":{"type":"object","nullable":true},"settings":{"$ref":"#/components/schemas/ContributionSettings"},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"updatedAt":{"type":"string","format":"date-time","description":"Last modification timestamp (ISO 8601)"}}},"ContributionTemplateCreate":{"type":"object","description":"Request body for creating/updating contribution template","properties":{"name":{"type":"string","description":"Display name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"visibility":{"type":"string","enum":["private","organization"],"description":"Use private for personal templates; omit or use organization for active-org templates."},"category":{"type":"string","nullable":true},"metadata":{"type":"object","nullable":true},"template":{"type":"object","nullable":true},"settings":{"$ref":"#/components/schemas/ContributionSettings"}},"required":["name"]},"LocationData":{"type":"object","description":"Location information","properties":{"zipCode":{"type":"string","nullable":true,"description":"ZIP/postal code"},"city":{"type":"string","nullable":true,"description":"City name"},"state":{"type":"string","nullable":true,"description":"2-letter state code"},"stateName":{"type":"string","nullable":true,"description":"State or province name"},"county":{"type":"string","nullable":true,"description":"County name"},"latitude":{"type":"number","description":"Geographic latitude coordinate"},"longitude":{"type":"number","description":"Geographic longitude coordinate"},"country":{"type":"string","default":"US","description":"Country name or code"},"displayName":{"type":"string","description":"Formatted display name"}}},"ParseRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"object","required":["base64"],"properties":{"base64":{"type":"string","description":"Base64-encoded file content"},"mimeType":{"type":"string","default":"application/pdf","description":"MIME type"},"name":{"type":"string","description":"Display name"}},"description":"File data or reference"},"kind":{"type":"string","enum":["benefit","rate","census"],"default":"benefit","description":"Resource kind/type identifier"},"engine":{"type":"string","enum":["auto","azure","pdf"],"default":"auto","description":"Parsing engine to use (textract, azure-di)"},"options":{"type":"object","description":"Parsing options (extractTables, detectBenefits, etc.)"}},"description":"Request body for document parsing with base64-encoded content"},"ParseUrlRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","description":"URL of the document to parse"},"kind":{"type":"string","enum":["benefit","rate","census"],"default":"benefit","description":"Resource kind/type identifier"},"engine":{"type":"string","enum":["auto","azure","pdf"],"default":"auto","description":"Processing engine to use"},"options":{"type":"object","description":"Available options"}},"description":"Request body for parsing a document from a URL"},"ParseResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the parse was successful"},"data":{"type":"object","description":"Parsed benefit/rate data"},"requestId":{"type":"string","description":"Unique request identifier for tracking"},"durationMs":{"type":"integer","description":"Processing duration in milliseconds"}},"description":"Response from document parsing including extracted plans and tables"},"EnginesResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"engines":{"type":"object","properties":{"azure":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether this is enabled"}},"description":"Azure Document Intelligence engine"},"docai":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether this is enabled"}},"description":"Google Document AI engine"},"pdf":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether this is enabled"}},"description":"PDF processing engine"}},"description":"Available processing engines"},"requestId":{"type":"string","description":"Unique request identifier for tracking"}},"description":"List of available document parsing engines and their capabilities"},"Organization":{"type":"object","description":"Organization/team entity","properties":{"id":{"type":"string","pattern":"^org_[a-zA-Z0-9]+$","description":"Unique organization identifier","example":"org_xyz789"},"name":{"type":"string","description":"Organization display name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"max_users":{"type":"integer","description":"Maximum allowed users"},"billing_email":{"type":"string","format":"email","nullable":true,"description":"Billing contact email address"},"tier":{"type":"string","enum":["free","pro","enterprise"],"description":"Enrollment or pricing tier"},"owner_id":{"type":"string","description":"Owner user identifier"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"updated_at":{"type":"string","format":"date-time","description":"Last update timestamp (ISO 8601)"},"slug":{"type":"string","pattern":"^[a-z0-9-]+$","description":"URL-friendly organization identifier","example":"benefits-consulting"},"createdAt":{"type":"string","format":"date-time","description":"Organization creation timestamp"}},"example":{"id":"org_xyz789","name":"Benefits Consulting Group","slug":"bcg","memberCount":15,"plan":"professional"}},"OrganizationCreate":{"type":"object","description":"Request body for creating/updating organization","properties":{"name":{"type":"string","description":"Organization name"},"description":{"type":"string","nullable":true,"description":"Detailed description"},"max_users":{"type":"integer","default":10,"description":"Maximum allowed users"},"billing_email":{"type":"string","format":"email","nullable":true,"description":"Billing contact email address"},"tier":{"type":"string","enum":["free","pro","enterprise"],"default":"free","description":"Enrollment or pricing tier"}}},"TeamMember":{"type":"object","description":"Organization team member","properties":{"user_id":{"type":"string","description":"User identifier"},"org_id":{"type":"string","description":"Organization identifier"},"role":{"type":"string","enum":["viewer","editor","admin","owner"],"description":"User role (owner, admin, member)"},"status":{"type":"string","enum":["active","inactive","pending"],"description":"Current status"},"email":{"type":"string","format":"email","nullable":true,"description":"Email address"},"display_name":{"type":"string","nullable":true,"description":"User display name"},"invited_by":{"type":"string","nullable":true,"description":"User ID who sent the invitation"},"joined_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp when user joined"},"last_seen_at":{"type":"string","format":"date-time","nullable":true,"description":"Last activity timestamp"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"}}},"Invitation":{"type":"object","description":"Organization invitation","properties":{"id":{"type":"string","description":"Unique identifier"},"org_id":{"type":"string","description":"Organization identifier"},"email":{"type":"string","format":"email","description":"Email address"},"role":{"type":"string","enum":["viewer","editor","admin"],"description":"User role (owner, admin, member)"},"status":{"type":"string","enum":["pending","accepted","expired","revoked"],"description":"Current status"},"invited_by":{"type":"string","description":"User ID who sent the invitation"},"expires_at":{"type":"string","format":"date-time","description":"Expiration timestamp"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"}}},"UserProfile":{"type":"object","description":"User profile","properties":{"id":{"type":"string","description":"Unique user identifier","example":"user_abc123"},"user_id":{"type":"string","description":"User identifier"},"display_name":{"type":"string","nullable":true,"description":"User display name"},"email":{"type":"string","format":"email","description":"User's email address"},"phone":{"type":"string","nullable":true,"description":"Phone number"},"company":{"type":"string","nullable":true,"description":"Company name"},"title":{"type":"string","nullable":true,"description":"Job title"},"avatar_url":{"type":"string","format":"uri","nullable":true,"description":"Profile avatar image URL"},"primary_org_id":{"type":"string","nullable":true,"description":"Primary organization identifier"},"notification_preferences":{"type":"object","nullable":true,"description":"User notification settings"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"updated_at":{"type":"string","format":"date-time","description":"Last update timestamp (ISO 8601)"},"name":{"type":"string","description":"User's display name"},"avatar":{"type":"string","format":"uri","nullable":true,"description":"URL to user's avatar image"},"createdAt":{"type":"string","format":"date-time","description":"Account creation timestamp"},"lastLoginAt":{"type":"string","format":"date-time","description":"Last login timestamp"}},"example":{"id":"user_abc123","email":"user@example.com","name":"John Smith"}},"UserProfileUpdate":{"type":"object","description":"Request body for updating user profile","properties":{"display_name":{"type":"string","description":"User display name"},"email":{"type":"string","format":"email","description":"Email address"},"phone":{"type":"string","description":"Phone number"},"company":{"type":"string","description":"Company name"},"title":{"type":"string","description":"Job title"},"avatar_url":{"type":"string","format":"uri","description":"Profile avatar image URL"},"primary_org_id":{"type":"string","description":"Must be an org the user is a member of"},"notification_preferences":{"type":"object","description":"User notification settings"}}},"Subscription":{"type":"object","description":"User subscription","properties":{"id":{"type":"string","description":"Subscription identifier"},"user_id":{"type":"string","description":"User identifier"},"org_id":{"type":"string","nullable":true,"description":"Organization identifier"},"provider":{"type":"string","enum":["stripe","manual"],"description":"Service provider"},"provider_subscription_id":{"type":"string","nullable":true,"description":"Payment provider subscription ID"},"provider_customer_id":{"type":"string","nullable":true,"description":"Payment provider customer ID"},"plan_id":{"type":"string","description":"Plan identifier (e.g., 'pro', 'enterprise')"},"status":{"type":"string","enum":["active","canceled","past_due","trialing"],"description":"Subscription status (active, canceled, past_due)"},"current_period_start":{"type":"integer","description":"Unix timestamp"},"current_period_end":{"type":"integer","description":"Unix timestamp"},"amount":{"type":"integer","description":"Amount in cents"},"currency":{"type":"string","default":"usd","description":"Currency code"},"interval":{"type":"string","enum":["month","year"],"description":"Billing interval (month, year)"},"canceled_at":{"type":"integer","nullable":true,"description":"Cancellation timestamp"},"created_at":{"type":"integer","description":"Creation timestamp (ISO 8601)"},"updated_at":{"type":"integer","description":"Last update timestamp (ISO 8601)"}}},"SubscriptionCreate":{"type":"object","description":"Request body for creating subscription","properties":{"org_id":{"type":"string","nullable":true,"description":"Organization identifier"},"provider":{"type":"string","enum":["stripe","manual"],"default":"stripe","description":"Service provider"},"provider_subscription_id":{"type":"string","nullable":true,"description":"Payment provider subscription ID"},"provider_customer_id":{"type":"string","nullable":true,"description":"Payment provider customer ID"},"plan_id":{"type":"string","default":"pro","description":"Subscription plan identifier"},"amount":{"type":"integer","description":"Monetary amount"},"currency":{"type":"string","default":"usd","description":"Currency code"},"interval":{"type":"string","enum":["month","year"],"default":"month","description":"Billing interval (month, year)"}}},"SessionInfo":{"type":"object","description":"Session information","properties":{"id":{"type":"string","description":"Unique identifier"},"user_id":{"type":"string","description":"User identifier"},"device":{"type":"string","nullable":true,"description":"Device/browser info"},"ip_address":{"type":"string","nullable":true,"description":"Client IP address"},"is_current":{"type":"boolean","description":"Whether this is the current session"},"idle_time_ms":{"type":"integer","description":"Milliseconds since last activity"},"expires_at":{"type":"string","format":"date-time","description":"Expiration timestamp"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp (ISO 8601)"},"last_activity_at":{"type":"string","format":"date-time","description":"Last activity timestamp"}}},"GenericRequest":{"type":"object","description":"Generic request payload (schema varies by endpoint).","additionalProperties":true},"GenericResponse":{"type":"object","description":"Generic response payload (schema varies by endpoint).","additionalProperties":true},"CognitoConfigResponse":{"type":"object","description":"Public Cognito configuration for client authentication.","properties":{"userPoolId":{"type":"string","description":"Cognito User Pool ID"},"clientId":{"type":"string","description":"Cognito App Client ID"},"region":{"type":"string","description":"AWS region for Cognito"},"domain":{"type":"string","description":"Cognito hosted UI domain"},"hostedUiUrl":{"type":"string","description":"Cognito hosted UI authorization endpoint"},"logoutUrl":{"type":"string","description":"Cognito logout endpoint"},"supportedProviders":{"type":"array","items":{"type":"string"}},"scopes":{"type":"array","items":{"type":"string"}},"supportsOfflineAccess":{"type":"boolean"}},"required":["userPoolId","clientId","region","domain","hostedUiUrl","logoutUrl"]},"CognitoTokenRequest":{"type":"object","description":"Exchange authorization code for tokens.","properties":{"code":{"type":"string","description":"Authorization code"},"redirect_uri":{"type":"string"},"code_verifier":{"type":"string"}},"required":["code"]},"CognitoTokenResponse":{"type":"object","properties":{"id_token":{"type":"string"},"access_token":{"type":"string"},"refresh_token":{"type":"string"},"expires_in":{"type":"integer"},"token_type":{"type":"string"}},"required":["id_token","access_token","expires_in"]},"CognitoRefreshRequest":{"type":"object","properties":{"refreshToken":{"type":"string"}},"required":["refreshToken"]},"CognitoRefreshResponse":{"type":"object","properties":{"id_token":{"type":"string"},"access_token":{"type":"string"},"expires_in":{"type":"integer"},"token_type":{"type":"string"}},"required":["id_token","access_token","expires_in"]},"CognitoSendVerificationCodeRequest":{"type":"object","properties":{"phoneNumber":{"type":"string","pattern":"^\\+[1-9]\\d{1,14}$"}},"required":["phoneNumber"]},"CognitoSendVerificationCodeResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]},"CognitoVerifyPhoneRequest":{"type":"object","properties":{"verificationCode":{"type":"string","pattern":"^\\d{6}$"}},"required":["verificationCode"]},"CognitoVerifyPhoneResponse":{"type":"object","properties":{"success":{"type":"boolean"},"trialGranted":{"type":"boolean"},"message":{"type":"string"},"groups":{"type":"array","items":{"type":"object"}},"trialUserCreated":{"type":"boolean"},"requiresTokenRefresh":{"type":"boolean"}},"required":["success"]},"MfaSetupResponse":{"type":"object","properties":{"success":{"type":"boolean"},"secretCode":{"type":"string"},"qrCodeUrl":{"type":"string"},"message":{"type":"string"}},"required":["success","secretCode","qrCodeUrl"]},"MfaVerifyRequest":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"]},"MfaVerifyResponse":{"type":"object","properties":{"success":{"type":"boolean"},"mfaEnabled":{"type":"boolean"},"message":{"type":"string"}},"required":["success","mfaEnabled"]},"MfaDisableRequest":{"type":"object","properties":{"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["code"]},"MfaDisableResponse":{"type":"object","properties":{"success":{"type":"boolean"},"mfaEnabled":{"type":"boolean"},"message":{"type":"string"}},"required":["success","mfaEnabled"]},"MfaStatusResponse":{"type":"object","properties":{"success":{"type":"boolean"},"mfaEnabled":{"type":"boolean"},"mfaType":{"type":"string","nullable":true},"setupInProgress":{"type":"boolean"},"verifiedAt":{"type":"string","format":"date-time","nullable":true}},"required":["success","mfaEnabled"]},"MfaChallengeRequest":{"type":"object","properties":{"userId":{"type":"string"},"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["userId","code"]},"MfaChallengeResponse":{"type":"object","properties":{"success":{"type":"boolean"},"verified":{"type":"boolean"},"message":{"type":"string"}},"required":["success","verified"]},"MfaCheckRequiredRequest":{"type":"object","properties":{"userId":{"type":"string"}},"required":["userId"]},"MfaCheckRequiredResponse":{"type":"object","properties":{"success":{"type":"boolean"},"mfaRequired":{"type":"boolean"}},"required":["success","mfaRequired"]},"WebhookStatusResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"enabled":{"type":"object","properties":{"stripe":{"type":"boolean"},"slack":{"type":"boolean"},"hubspot":{"type":"boolean"},"salesforce":{"type":"boolean"},"generic":{"type":"boolean"}}}},"required":["ok","enabled"]},"WebhookSuccessResponse":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"]},"WebhookErrorResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"provider":{"type":"string","enum":["stripe","slack","hubspot","salesforce","generic"]},"error":{"type":"string"}},"required":["ok","error"]},"SlackWebhookPayload":{"type":"object","properties":{"type":{"type":"string","enum":["url_verification","event_callback"]},"challenge":{"type":"string"},"event_id":{"type":"string"},"event":{"type":"object"}}},"HubSpotWebhookPayload":{"type":"object","additionalProperties":true},"SalesforceWebhookPayload":{"type":"object","additionalProperties":true},"CognitoErrorResponse":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"code":{"type":"string"},"requestId":{"type":"string"}},"required":["error","message"]},"BenefitsMap":{"type":"object","description":"Keyed benefits map where each entry contains a parsed value.","additionalProperties":{"$ref":"#/components/schemas/BenefitValue"}},"AiParseTextRequest":{"type":"object","properties":{"text":{"type":"string","description":"Text content to parse"},"forceAI":{"type":"boolean","description":"Force AI processing even if basic parsing succeeds"}},"required":["text"],"description":"Request body for AI-powered text parsing"},"AiParseDocumentResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"benefits":{"$ref":"#/components/schemas/BenefitsMap"},"carrier":{"type":"string","nullable":true,"description":"Insurance carrier name"},"planName":{"type":"string","nullable":true,"description":"Plan display name"},"planType":{"type":"string","nullable":true,"description":"Plan type classification"},"confidence":{"type":"string","description":"Confidence score (0-1)"},"source":{"type":"string","description":"Data source"},"cost":{"type":"number","description":"Cost amount"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"},"requestId":{"type":"string","description":"Unique request identifier for tracking"},"rawText":{"type":"string","description":"Raw extracted text before processing"},"error":{"type":"string","description":"Error message if failed"},"message":{"type":"string","description":"Response or status message"}},"required":["ok"],"description":"Response from AI document parsing with extracted data"},"AiParseBulkRequest":{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","description":"Text content to parse"},"fileName":{"type":"string","description":"Name of the file"}},"required":["text"]},"description":"Array of documents to process"},"forceAI":{"type":"boolean","description":"Force AI processing even if basic parsing succeeds"}},"required":["documents"],"description":"Request body for bulk document parsing"},"AiParseBulkResultItem":{"type":"object","properties":{"index":{"type":"integer","description":"Index position in batch"},"fileName":{"type":"string","description":"Name of the file"},"ok":{"type":"boolean","description":"Whether the operation succeeded"},"benefits":{"$ref":"#/components/schemas/BenefitsMap"},"carrier":{"type":"string","nullable":true,"description":"Insurance carrier name"},"planName":{"type":"string","nullable":true,"description":"Plan display name"},"planType":{"type":"string","nullable":true,"description":"Plan type classification"},"confidence":{"type":"string","description":"Confidence score (0-1)"},"source":{"type":"string","description":"Data source"},"cost":{"type":"number","description":"Cost amount"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"},"error":{"type":"string","description":"Error message if failed"}},"required":["index","ok"],"description":"Result for a single document in a bulk parse operation"},"AiParseBulkResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"results":{"type":"array","items":{"$ref":"#/components/schemas/AiParseBulkResultItem"},"description":"Array of results"},"summary":{"type":"object","properties":{"total":{"type":"integer","description":"Total number"},"success":{"type":"integer","description":"Whether the operation was successful"},"failed":{"type":"integer","description":"Number of failed operations"},"totalCost":{"type":"number","description":"Total cost incurred"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"}},"description":"Summary text"},"requestId":{"type":"string","description":"Unique request identifier for tracking"},"error":{"type":"string","description":"Error message if failed"},"message":{"type":"string","description":"Response or status message"}},"required":["ok","results","summary"],"description":"Response from bulk document parsing operation"},"AiParseCompareResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"basic":{"type":"object","properties":{"benefits":{"$ref":"#/components/schemas/BenefitsMap"},"source":{"type":"string","description":"Data source"},"cost":{"type":"number","description":"Cost amount"}},"description":"Basic parsing result"},"ai":{"type":"object","properties":{"benefits":{"$ref":"#/components/schemas/BenefitsMap"},"carrier":{"type":"string","nullable":true,"description":"Insurance carrier name"},"planName":{"type":"string","nullable":true,"description":"Plan display name"},"planType":{"type":"string","nullable":true,"description":"Plan type classification"},"confidence":{"type":"string","description":"Confidence score (0-1)"},"source":{"type":"string","description":"Data source"},"cost":{"type":"number","description":"Cost amount"}},"description":"AI parsing result"},"comparison":{"type":"object","additionalProperties":{"type":"object","properties":{"basic":{"type":"string","nullable":true,"description":"Basic parsing result"},"ai":{"type":"string","nullable":true,"description":"AI parsing result"},"match":{"type":"boolean","description":"Whether results match"},"aiOnly":{"type":"boolean","description":"Field only found by AI parsing"},"basicOnly":{"type":"boolean","description":"Field only found by basic parsing"}}},"description":"Comparison between results"}},"required":["ok"],"description":"Response comparing multiple parsed documents"},"AiParseStatsResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"stats":{"type":"object","properties":{"totalCalls":{"type":"integer","description":"Total number of API calls"},"totalInputTokens":{"type":"integer","description":"Total input tokens processed"},"totalOutputTokens":{"type":"integer","description":"Total output tokens generated"},"totalCost":{"type":"number","description":"Total cost incurred"},"bypassedByBasicParsing":{"type":"integer","description":"Requests bypassed by basic parsing"},"bypassedByTextract":{"type":"integer","description":"Requests bypassed by Textract"},"textractCost":{"type":"number","description":"Cost for Textract usage"},"averageCostPerCall":{"type":"string","description":"Average cost per API call"},"costSavedByBasicParsing":{"type":"string","description":"Cost saved by using basic parsing"},"textractUsageCount":{"type":"integer","description":"Number of Textract calls"},"textractTotalCost":{"type":"string","description":"Total Textract costs"},"recentErrors":{"type":"array","items":{"type":"string"},"description":"Recent error messages"},"errorCount":{"type":"integer","description":"Total error count"}},"description":"Statistics"},"textract":{"type":"object","nullable":true,"description":"Textract service status/config"}},"required":["ok"],"description":"Statistics about AI parsing usage and accuracy"},"AiParseTextractStatusResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"available":{"type":"boolean","description":"Whether available"},"initialized":{"type":"boolean","description":"Whether service is initialized"},"enabled":{"type":"boolean","description":"Whether this is enabled"},"ready":{"type":"boolean","description":"Whether service is ready for requests"},"budgetExceeded":{"type":"boolean","description":"Whether budget limit was exceeded"},"reason":{"type":"string","description":"Explanation or reason text"},"config":{"type":"object","properties":{"region":{"type":"string","description":"AWS region"},"hourlyBudget":{"type":"string","description":"Hourly budget limit"},"dailyBudget":{"type":"string","description":"Daily budget limit"}},"description":"Configuration settings"},"stats":{"type":"object","description":"Statistics"}},"required":["ok"],"description":"Status of AWS Textract service availability"},"AiParseTextractTablesResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"tables":{"type":"array","items":{"type":"object"},"description":"Extracted table data"},"tableCount":{"type":"integer","description":"Number of tables extracted"},"pageCount":{"type":"integer","description":"Number of pages processed"},"cost":{"type":"number","description":"Cost amount"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"}},"required":["ok"],"description":"Tables extracted using AWS Textract"},"AiParseTextractFormsResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"forms":{"type":"array","items":{"type":"object"},"description":"Extracted form field data"},"formCount":{"type":"integer","description":"Number of form fields extracted"},"pageCount":{"type":"integer","description":"Number of pages processed"},"cost":{"type":"number","description":"Cost amount"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"}},"required":["ok"],"description":"Form fields extracted using AWS Textract"},"AiParseTextractQueriesResponse":{"type":"object","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"queries":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","description":"Text content to parse"},"alias":{"type":"string","nullable":true,"description":"Query alias/identifier"},"answer":{"type":"string","nullable":true,"description":"Query answer/result"},"confidence":{"type":"number","description":"Confidence score (0-1)"},"pageNumber":{"type":"integer","description":"Page number where result was found"}}},"description":"Query results from document analysis"},"benefits":{"$ref":"#/components/schemas/BenefitsMap"},"pageCount":{"type":"integer","description":"Number of pages processed"},"cost":{"type":"number","description":"Cost amount"},"source":{"type":"string","description":"Data source"},"durationMs":{"type":"number","description":"Processing duration in milliseconds"}},"required":["ok"],"description":"Query results from AWS Textract document analysis"},"CloudStorageProviderFeatures":{"type":"object","properties":{"upload":{"type":"boolean","description":"Upload capability supported"},"download":{"type":"boolean","description":"Download capability supported"},"list":{"type":"boolean","description":"List of items"},"delete":{"type":"boolean","description":"Delete capability supported"},"folders":{"type":"boolean","description":"Folder operations supported"},"sharing":{"type":"boolean","description":"Sharing capability supported"},"versioning":{"type":"boolean","description":"Version history supported"}},"additionalProperties":true,"description":"Features supported by a cloud storage provider"},"CloudStorageProvider":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","description":"Detailed description"},"icon":{"type":"string","description":"Provider icon URL"},"features":{"$ref":"#/components/schemas/CloudStorageProviderFeatures"}},"description":"Cloud storage provider configuration and connection status"},"CloudStorageProvidersResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/CloudStorageProvider"},"description":"Available providers"}},"required":["success","providers"],"description":"List of available cloud storage providers"},"CloudStorageStatusResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"provider":{"type":"string","description":"Service provider"},"connected":{"type":"boolean","description":"Whether connected"},"status":{"type":"string","description":"Current status"},"connectedAt":{"type":"string","format":"date-time","nullable":true,"description":"Connection timestamp"},"connectedBy":{"type":"string","nullable":true,"description":"User who connected the integration"},"externalAccountEmail":{"type":"string","nullable":true,"description":"Email of connected external account"},"externalAccountName":{"type":"string","nullable":true,"description":"Name of connected external account"},"tokenExpiresAt":{"type":"string","format":"date-time","nullable":true,"description":"OAuth token expiration time"},"lastUsedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last usage timestamp"},"rootFolderId":{"type":"string","nullable":true,"description":"Root folder identifier"},"rootFolderPath":{"type":"string","nullable":true,"description":"Root folder path"}},"required":["success","provider"],"description":"Connection status for a cloud storage provider"},"CloudStorageFile":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"mimeType":{"type":"string","description":"MIME type"},"size":{"type":"integer","description":"Size in bytes"},"isFolder":{"type":"boolean","description":"Whether this item is a folder"},"webViewLink":{"type":"string","nullable":true,"description":"URL to view the file in browser"},"downloadLink":{"type":"string","nullable":true,"description":"Direct download URL"},"createdAt":{"type":"string","format":"date-time","nullable":true,"description":"Creation timestamp (ISO 8601)"},"modifiedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last modification timestamp"},"parentId":{"type":"string","nullable":true,"description":"Parent folder identifier"},"iconLink":{"type":"string","nullable":true,"description":"URL to file type icon"},"thumbnailLink":{"type":"string","nullable":true,"description":"URL to thumbnail preview"},"checksum":{"type":"string","nullable":true,"description":"File checksum for integrity verification"},"description":{"type":"string","nullable":true,"description":"Detailed description"}},"additionalProperties":true,"description":"File or folder in cloud storage with metadata"},"CloudStorageListResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"files":{"type":"array","items":{"$ref":"#/components/schemas/CloudStorageFile"},"description":"List of files"},"nextPageToken":{"type":"string","nullable":true,"description":"Token for fetching next page of results"},"hasMore":{"type":"boolean","description":"Whether more results are available"}},"required":["success","files"],"description":"List of files/folders from cloud storage"},"CloudStorageUploadResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"fileId":{"type":"string","description":"Unique file identifier"},"fileName":{"type":"string","description":"Name of the file"},"webViewLink":{"type":"string","nullable":true,"description":"URL to view the file in browser"},"downloadLink":{"type":"string","nullable":true,"description":"Direct download URL"},"size":{"type":"integer","description":"Size in bytes"}},"required":["success"],"description":"Response from uploading a file to cloud storage"},"CloudStorageFileResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"file":{"$ref":"#/components/schemas/CloudStorageFile"}},"required":["success","file"],"description":"Details of a single file in cloud storage"},"CloudStorageDeleteResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"deleted":{"type":"boolean","description":"Whether item was deleted"}},"required":["success","deleted"],"description":"Response from deleting a cloud storage file"},"CloudStorageCreateFolderResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"folderId":{"type":"string","description":"Folder identifier"},"folderName":{"type":"string","description":"Folder display name"},"webViewLink":{"type":"string","nullable":true,"description":"URL to view the file in browser"}},"required":["success","folderId"],"description":"Response from creating a cloud storage folder"},"CloudStorageRootFolderResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"rootFolderId":{"type":"string","description":"Root folder identifier"},"rootFolderPath":{"type":"string","nullable":true,"description":"Root folder path"}},"required":["success","rootFolderId"],"description":"Root folder configuration for cloud storage"},"CloudStorageCaseFilesResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"files":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"externalFileId":{"type":"string","description":"File ID in external storage system"},"fileName":{"type":"string","description":"Name of the file"},"mimeType":{"type":"string","description":"MIME type"},"fileSize":{"type":"integer","description":"File size in bytes"},"webViewLink":{"type":"string","nullable":true,"description":"URL to view the file in browser"},"downloadLink":{"type":"string","nullable":true,"description":"Direct download URL"},"syncDirection":{"type":"string","description":"Sync direction (upload/download/bidirectional)"},"lastSyncedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last sync timestamp"},"accountEmail":{"type":"string","nullable":true,"description":"External account email"},"accountName":{"type":"string","nullable":true,"description":"External account display name"}}},"description":"List of files"}},"required":["success","files"],"description":"Files associated with a specific case in cloud storage"},"IntegrationProviderDefinition":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","description":"Detailed description"},"category":{"type":"string","description":"Integration category (CRM, storage, etc.)"},"authType":{"type":"string","description":"Authentication type (oauth, apikey, etc.)"},"flag":{"type":"string","description":"Feature flag name for this integration"},"dataAccess":{"type":"object","properties":{"read":{"type":"array","items":{"type":"string"},"description":"Read permission granted"},"write":{"type":"array","items":{"type":"string"},"description":"Write permission granted"}},"description":"Data access permissions"},"requiresSubdomain":{"type":"boolean","description":"Whether subdomain is required for connection"},"requiresTenant":{"type":"boolean","description":"Whether tenant ID is required"}},"additionalProperties":true,"description":"Definition of a third-party integration provider"},"IntegrationProviderInfo":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","description":"Detailed description"},"authType":{"type":"string","description":"Authentication type (oauth, apikey, etc.)"},"capabilities":{"type":"array","items":{"type":"string"},"description":"Supported capabilities"}},"additionalProperties":true,"description":"Current status and configuration of an integration"},"IntegrationProvidersResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationProviderDefinition"},"description":"Available providers"}},"required":["success","providers"],"description":"List of available integration providers"},"IntegrationProviderListResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationProviderInfo"},"description":"Available providers"}},"required":["success","providers"],"description":"Detailed list of integration providers with status"},"IntegrationCatalogItem":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"description":{"type":"string","description":"Detailed description"},"category":{"type":"string","description":"Integration category (CRM, storage, etc.)"},"auth":{"type":"object","properties":{"type":{"type":"string","description":"Resource type"},"oauthUrl":{"type":"string","description":"OAuth authorization URL"}},"description":"Authentication configuration"},"status":{"type":"string","description":"Current status"},"lastSynced":{"type":"string","format":"date-time","nullable":true,"description":"Last data sync timestamp"},"audit":{"type":"object","properties":{"connectedBy":{"type":"string","nullable":true,"description":"User who connected the integration"},"connectedAt":{"type":"string","format":"date-time","nullable":true,"description":"Connection timestamp"}},"description":"Audit trail information"},"dataAccess":{"type":"object","properties":{"read":{"type":"array","items":{"type":"string"},"description":"Read permission granted"},"write":{"type":"array","items":{"type":"string"},"description":"Write permission granted"}},"description":"Data access permissions"},"scope":{"type":"object","properties":{"org":{"type":"string","description":"Organization scope settings"},"syncDirection":{"type":"string","description":"Sync direction (upload/download/bidirectional)"},"frequency":{"type":"string","description":"Frequency (e.g., pay periods per year)"}},"description":"Permission scope"},"actions":{"type":"array","items":{"type":"string"},"description":"Available actions"}},"additionalProperties":true,"description":"Integration available in the integration catalog"},"IntegrationCatalogResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationCatalogItem"},"description":"Available providers"}},"required":["success","providers"],"description":"Full catalog of available integrations"},"IntegrationConnectResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"redirectUrl":{"type":"string","description":"OAuth redirect URL"},"provider":{"$ref":"#/components/schemas/IntegrationCatalogItem"}},"required":["success"],"description":"Response from connecting an integration"},"IntegrationDisconnectResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"provider":{"$ref":"#/components/schemas/IntegrationCatalogItem"}},"required":["success"],"description":"Response from disconnecting an integration"},"IntegrationTestResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"provider":{"$ref":"#/components/schemas/IntegrationCatalogItem"}},"required":["success"],"description":"Response from testing an integration connection"},"IntegrationConnectionStatus":{"type":"object","properties":{"connected":{"type":"boolean","description":"Whether connected"},"accountId":{"type":"string","nullable":true,"description":"External account identifier"},"accountName":{"type":"string","nullable":true,"description":"External account display name"},"connectedAt":{"type":"string","format":"date-time","nullable":true,"description":"Connection timestamp"},"lastSyncedAt":{"type":"string","format":"date-time","nullable":true,"description":"Last sync timestamp"},"error":{"type":"string","nullable":true,"description":"Error message if failed"}},"description":"Current connection status for an integration"},"IntegrationOAuthProvider":{"type":"object","properties":{"id":{"type":"string","description":"Unique identifier"},"name":{"type":"string","description":"Display name"},"type":{"type":"string","description":"Resource type"},"configured":{"type":"boolean","description":"Whether integration is configured"},"scopes":{"type":"array","items":{"type":"string"},"description":"API scopes"},"requiresSubdomain":{"type":"boolean","description":"Whether subdomain is required for connection"},"requiresTenant":{"type":"boolean","description":"Whether tenant ID is required"},"authUrlTemplate":{"type":"string","description":"OAuth authorization URL template"},"tokenUrlTemplate":{"type":"string","description":"OAuth token exchange URL template"}},"additionalProperties":true,"description":"OAuth-based integration provider configuration"},"IntegrationOAuthProvidersResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"providers":{"type":"array","items":{"$ref":"#/components/schemas/IntegrationOAuthProvider"},"description":"Available providers"}},"required":["success","providers"],"description":"List of OAuth integration providers"},"IntegrationOAuthUrlResponse":{"type":"object","properties":{"success":{"type":"boolean","description":"Whether the operation was successful"},"provider":{"type":"string","description":"Service provider"},"name":{"type":"string","description":"Display name"},"authorizationUrl":{"type":"string","description":"Full authorization URL"},"redirectUri":{"type":"string","description":"OAuth callback redirect URI"},"configured":{"type":"boolean","description":"Whether integration is configured"},"requiresSubdomain":{"type":"boolean","description":"Whether subdomain is required for connection"},"requiresTenant":{"type":"boolean","description":"Whether tenant ID is required"}},"required":["success","provider","authorizationUrl"],"description":"OAuth authorization URL for initiating connection"},"PaginationMeta":{"type":"object","description":"Pagination metadata included in list responses","properties":{"total":{"type":"integer","description":"Total number of items across all pages","example":150},"limit":{"type":"integer","description":"Maximum items per page (as requested)","example":20},"offset":{"type":"integer","description":"Number of items skipped","example":0},"hasMore":{"type":"boolean","description":"Whether more items exist beyond this page","example":true},"nextOffset":{"type":"integer","nullable":true,"description":"Offset to use for next page (null if no more pages)","example":20}}},"PaginatedResponse":{"type":"object","description":"Base schema for paginated responses","properties":{"ok":{"type":"boolean","description":"Whether the operation succeeded"},"items":{"type":"array","items":{"type":"object"},"description":"Array of items"},"pagination":{"$ref":"#/components/schemas/PaginationMeta"}}},"BenAdminCredentials":{"type":"object","description":"Credentials for connecting to a ben-admin provider","properties":{"accessToken":{"type":"string","description":"OAuth access token"},"refreshToken":{"type":"string","description":"OAuth refresh token"},"apiKey":{"type":"string","description":"API key for non-OAuth providers"}}},"SyncConfig":{"type":"object","description":"Configuration for data synchronization","properties":{"org":{"type":"string","description":"Organization name or identifier"},"syncDirection":{"type":"string","enum":["pull","push","bidirectional"],"description":"Direction of data sync"},"frequency":{"type":"string","enum":["realtime","hourly","daily","weekly","monthly","manual"],"description":"Sync frequency"},"webhookUrl":{"type":"string","description":"Webhook URL for real-time updates"}}},"BenAdminConnectRequest":{"type":"object","description":"Request body for connecting to a ben-admin provider","required":["credentials"],"properties":{"credentials":{"$ref":"#/components/schemas/BenAdminCredentials"},"syncConfig":{"$ref":"#/components/schemas/SyncConfig"},"scope":{"$ref":"#/components/schemas/SyncConfig"},"orgId":{"type":"string","description":"Organization ID (optional)"}}},"BenAdminConnectResponse":{"type":"object","description":"Response from connecting to a ben-admin provider","required":["success"],"properties":{"success":{"type":"boolean"},"connected":{"type":"boolean"},"providerId":{"type":"string"},"accountId":{"type":"string"},"accountName":{"type":"string"},"connectedAt":{"type":"string","format":"date-time"},"error":{"type":"string"}}},"BenAdminDisconnectRequest":{"type":"object","description":"Request body for disconnecting from a ben-admin provider","properties":{"orgId":{"type":"string","description":"Organization ID (optional)"}}},"BenAdminDisconnectResponse":{"type":"object","description":"Response from disconnecting from a ben-admin provider","required":["success"],"properties":{"success":{"type":"boolean"},"disconnected":{"type":"boolean"},"error":{"type":"string"}}},"EnrollmentElection":{"type":"object","description":"Individual employee enrollment election","required":["employeeId","planId"],"properties":{"employeeId":{"type":"string","description":"Employee identifier"},"planId":{"type":"string","description":"Plan identifier"},"tier":{"type":"string","description":"Coverage tier"},"electionType":{"type":"string","enum":["enroll","waive","decline"]}}},"BenAdminEnrollmentRequest":{"type":"object","description":"Request body for posting enrollment elections","required":["groupId","effectiveDate","elections"],"properties":{"groupId":{"type":"string","description":"Employer group identifier"},"effectiveDate":{"type":"string","format":"date","description":"Effective date (ISO 8601)"},"elections":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentElection"},"minItems":1},"enrollmentType":{"type":"string","enum":["open_enrollment","new_hire","qualifying_event","rehire"]},"eventDate":{"type":"string","format":"date"},"eventType":{"type":"string"}}},"EnrollmentSubmissionResult":{"type":"object","description":"Result of an individual enrollment submission","properties":{"employeeId":{"type":"string"},"planId":{"type":"string"},"status":{"type":"string","enum":["submitted","pending","accepted","rejected"]},"confirmationNumber":{"type":"string"},"error":{"type":"string"}}},"BenAdminEnrollmentResponse":{"type":"object","description":"Response from posting enrollment elections","required":["success"],"properties":{"success":{"type":"boolean"},"submitted":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentSubmissionResult"}},"errors":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentSubmissionResult"}},"batchId":{"type":"string"},"error":{"type":"string"}}},"EnrollmentStatusRecord":{"type":"object","description":"Enrollment status for an employee","properties":{"employeeId":{"type":"string"},"planId":{"type":"string"},"tier":{"type":"string"},"status":{"type":"string","enum":["enrolled","waived","declined","pending","terminated"]},"effectiveDate":{"type":"string","format":"date"},"terminationDate":{"type":"string","format":"date","nullable":true},"submittedAt":{"type":"string","format":"date-time"}}},"BenAdminEnrollmentStatusResponse":{"type":"object","description":"Response containing enrollment status","required":["success"],"properties":{"success":{"type":"boolean"},"enrollments":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentStatusRecord"}},"groupId":{"type":"string"},"planYear":{"type":"integer"},"error":{"type":"string"}}},"BenAdminGroup":{"type":"object","description":"Employer group from ben-admin platform","properties":{"id":{"type":"string"},"name":{"type":"string"},"employeeCount":{"type":"integer"},"status":{"type":"string","enum":["active","inactive","pending"]},"effectiveDate":{"type":"string","format":"date"},"renewalDate":{"type":"string","format":"date"}}},"BenAdminGroupsResponse":{"type":"object","description":"Response containing list of employer groups","required":["success"],"properties":{"success":{"type":"boolean"},"groups":{"type":"array","items":{"$ref":"#/components/schemas/BenAdminGroup"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"error":{"type":"string"}}},"BenAdminPlan":{"type":"object","description":"Benefit plan from ben-admin platform","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"carrier":{"type":"string"},"planYear":{"type":"integer"}}},"BenAdminCensusEmployee":{"type":"object","description":"Employee from census data","properties":{"id":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"type":"string","format":"date"},"hireDate":{"type":"string","format":"date"},"status":{"type":"string","enum":["active","terminated","leave"]}}},"BenAdminGroupDetailResponse":{"type":"object","description":"Response containing detailed group information","required":["success"],"properties":{"success":{"type":"boolean"},"group":{"$ref":"#/components/schemas/BenAdminGroup"},"census":{"type":"array","items":{"$ref":"#/components/schemas/BenAdminCensusEmployee"}},"plans":{"type":"array","items":{"$ref":"#/components/schemas/BenAdminPlan"}},"rates":{"type":"object","additionalProperties":true},"error":{"type":"string"}}},"BenAdminSyncPlansRequest":{"type":"object","description":"Request body for syncing plans","required":["groupId"],"properties":{"direction":{"type":"string","enum":["push","pull","bidirectional"]},"groupId":{"type":"string"},"caseId":{"type":"string"},"plans":{"type":"array","items":{"type":"object","additionalProperties":true}},"benefitTypes":{"type":"array","items":{"type":"string"}},"effectiveDate":{"type":"string","format":"date"},"planYear":{"type":"integer"}}},"BenAdminSyncPlansResponse":{"type":"object","description":"Response from plan sync operation","required":["success"],"properties":{"success":{"type":"boolean"},"created":{"type":"array","items":{"type":"object","properties":{"planId":{"type":"string"},"name":{"type":"string"}}}},"updated":{"type":"array","items":{"type":"object","properties":{"planId":{"type":"string"},"name":{"type":"string"}}}},"synced":{"type":"array","items":{"type":"object","properties":{"planId":{"type":"string"},"name":{"type":"string"}}}},"errors":{"type":"array","items":{"type":"object","properties":{"planId":{"type":"string"},"error":{"type":"string"}}}},"error":{"type":"string"}}},"CRMCredentials":{"type":"object","description":"Credentials for connecting to a CRM provider","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"instanceUrl":{"type":"string","description":"Salesforce instance URL"},"portalId":{"type":"string","description":"HubSpot portal ID"}}},"CRMConnectRequest":{"type":"object","description":"Request body for connecting to a CRM provider","required":["credentials"],"properties":{"credentials":{"$ref":"#/components/schemas/CRMCredentials"},"syncConfig":{"$ref":"#/components/schemas/SyncConfig"},"scope":{"$ref":"#/components/schemas/SyncConfig"},"orgId":{"type":"string"}}},"CRMConnectResponse":{"type":"object","description":"Response from connecting to a CRM provider","required":["success"],"properties":{"success":{"type":"boolean"},"connected":{"type":"boolean"},"providerId":{"type":"string"},"accountId":{"type":"string"},"accountName":{"type":"string"},"connectedAt":{"type":"string","format":"date-time"},"error":{"type":"string"}}},"CRMDisconnectRequest":{"type":"object","description":"Request body for disconnecting from a CRM provider","properties":{"orgId":{"type":"string"}}},"CRMDisconnectResponse":{"type":"object","description":"Response from disconnecting from a CRM provider","required":["success"],"properties":{"success":{"type":"boolean"},"disconnected":{"type":"boolean"},"error":{"type":"string"}}},"CRMContact":{"type":"object","description":"Contact data for CRM sync","required":["email"],"properties":{"email":{"type":"string","format":"email"},"firstName":{"type":"string"},"lastName":{"type":"string"},"company":{"type":"string"},"phone":{"type":"string"},"title":{"type":"string"}}},"CRMSyncContactRequest":{"type":"object","description":"Request body for syncing a contact to CRM","required":["contact"],"properties":{"contact":{"$ref":"#/components/schemas/CRMContact"},"orgId":{"type":"string"}}},"CRMSyncContactResponse":{"type":"object","description":"Response from syncing a contact to CRM","required":["success"],"properties":{"success":{"type":"boolean"},"contactId":{"type":"string"},"created":{"type":"boolean"},"updated":{"type":"boolean"},"error":{"type":"string"}}},"CRMDeal":{"type":"object","description":"Deal/opportunity data for CRM sync","required":["name"],"properties":{"name":{"type":"string"},"amount":{"type":"number"},"stage":{"type":"string"},"contactId":{"type":"string"},"companyId":{"type":"string"},"closeDate":{"type":"string","format":"date"}}},"CRMSyncDealRequest":{"type":"object","description":"Request body for syncing a deal to CRM","required":["deal"],"properties":{"deal":{"$ref":"#/components/schemas/CRMDeal"},"caseId":{"type":"string"},"orgId":{"type":"string"}}},"CRMSyncDealResponse":{"type":"object","description":"Response from syncing a deal to CRM","required":["success"],"properties":{"success":{"type":"boolean"},"dealId":{"type":"string"},"created":{"type":"boolean"},"updated":{"type":"boolean"},"error":{"type":"string"}}},"CRMSyncCaseRequest":{"type":"object","description":"Request body for syncing a Planlined case to CRM","required":["caseId"],"properties":{"caseId":{"type":"string"},"syncContacts":{"type":"boolean","default":true},"syncCompany":{"type":"boolean","default":true},"createDeal":{"type":"boolean","default":true}}},"CRMSyncCaseResponse":{"type":"object","description":"Response from syncing a case to CRM","required":["success"],"properties":{"success":{"type":"boolean"},"contacts":{"type":"array","items":{"type":"object","properties":{"contactId":{"type":"string"},"email":{"type":"string"},"created":{"type":"boolean"}}}},"company":{"type":"object","properties":{"companyId":{"type":"string"},"name":{"type":"string"},"created":{"type":"boolean"}}},"deal":{"type":"object","properties":{"dealId":{"type":"string"},"name":{"type":"string"},"created":{"type":"boolean"}}},"error":{"type":"string"}}},"CRMActivity":{"type":"object","description":"Activity/note data for CRM logging","required":["type","subject"],"properties":{"type":{"type":"string","enum":["note","email","call","meeting","task"]},"subject":{"type":"string"},"body":{"type":"string"},"contactId":{"type":"string"},"dealId":{"type":"string"},"companyId":{"type":"string"}}},"CRMLogActivityRequest":{"type":"object","description":"Request body for logging an activity to CRM","required":["activity"],"properties":{"activity":{"$ref":"#/components/schemas/CRMActivity"},"orgId":{"type":"string"}}},"CRMLogActivityResponse":{"type":"object","description":"Response from logging an activity to CRM","required":["success"],"properties":{"success":{"type":"boolean"},"activityId":{"type":"string"},"error":{"type":"string"}}},"CRMFileAttachment":{"type":"object","description":"File attachment data for CRM upload","required":["name","content"],"properties":{"name":{"type":"string"},"content":{"type":"string","description":"Base64 encoded file content"},"mimeType":{"type":"string"}}},"CRMAttachTo":{"type":"object","description":"Target record for file attachment","required":["type","id"],"properties":{"type":{"type":"string","enum":["contact","deal","company"]},"id":{"type":"string"}}},"CRMUploadFileRequest":{"type":"object","description":"Request body for uploading a file to CRM","required":["file","attachTo"],"properties":{"file":{"$ref":"#/components/schemas/CRMFileAttachment"},"attachTo":{"$ref":"#/components/schemas/CRMAttachTo"},"orgId":{"type":"string"}}},"CRMUploadFileResponse":{"type":"object","description":"Response from uploading a file to CRM","required":["success"],"properties":{"success":{"type":"boolean"},"fileId":{"type":"string"},"url":{"type":"string"},"error":{"type":"string"}}},"OAuthDisconnectRequest":{"type":"object","description":"Request body for disconnecting an OAuth provider","properties":{"orgId":{"type":"string"}}},"OAuthDisconnectResponse":{"type":"object","description":"Response from disconnecting an OAuth provider","required":["success"],"properties":{"success":{"type":"boolean"},"provider":{"type":"string"},"disconnected":{"type":"boolean"},"error":{"type":"string"}}},"OAuthExchangeRequest":{"type":"object","description":"Request body for exchanging an authorization code for tokens (GIS flow)","required":["code"],"properties":{"code":{"type":"string","description":"Authorization code from OAuth provider"},"orgId":{"type":"string"}}},"OAuthExchangeResponse":{"type":"object","description":"Response from OAuth code exchange","required":["success"],"properties":{"success":{"type":"boolean"},"provider":{"type":"string"},"status":{"type":"string","enum":["connected","error"]},"expiresAt":{"type":"integer","description":"Token expiration timestamp (Unix ms)"},"error":{"type":"string"}}},"OAuthRefreshRequest":{"type":"object","description":"Request body for refreshing OAuth tokens","properties":{"orgId":{"type":"string"}}},"OAuthRefreshResponse":{"type":"object","description":"Response from OAuth token refresh","required":["success"],"properties":{"success":{"type":"boolean"},"provider":{"type":"string"},"expiresAt":{"type":"integer","description":"New token expiration timestamp (Unix ms)"},"error":{"type":"string"}}},"EnrollmentPortalSession":{"type":"object","additionalProperties":true,"required":["sessionId","sessionMode"],"properties":{"sessionId":{"type":"string","description":"Session id (UUID)"},"sessionMode":{"type":"string","description":"v1/v2 session mode"},"toggles":{"type":"object","additionalProperties":true,"description":"V2 toggles payload (employerName, branding, etc.)"},"payFrequency":{"type":"string","nullable":true},"planData":{"type":"object","additionalProperties":true,"nullable":true},"employerName":{"type":"string","nullable":true},"electionDeadline":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"ownerEmail":{"type":"string","format":"email","nullable":true},"ownerId":{"type":"string","nullable":true}}},"EnrollmentPortalSessionSummary":{"type":"object","additionalProperties":true,"required":["sessionId"],"properties":{"sessionId":{"type":"string"},"sessionMode":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"electionDeadline":{"type":"string","format":"date-time","nullable":true},"employerName":{"type":"string","nullable":true},"ownerEmail":{"type":"string","nullable":true},"ownerId":{"type":"string","nullable":true},"counts":{"type":"object","additionalProperties":true,"properties":{"total":{"type":"integer","minimum":0},"notOpened":{"type":"integer","minimum":0},"opened":{"type":"integer","minimum":0},"signed":{"type":"integer","minimum":0}}}}},"EnrollmentPortalForm":{"type":"object","additionalProperties":true,"required":["formId"],"properties":{"formId":{"type":"string"},"sessionId":{"type":"string"},"employeeFirstName":{"type":"string","nullable":true},"employeeLastName":{"type":"string","nullable":true},"employeeEmail":{"type":"string","format":"email","nullable":true},"employeeDob":{"type":"string","format":"date","nullable":true},"employeeSsn4":{"type":"string","nullable":true,"description":"Last 4 of SSN"},"status":{"type":"string","description":"pending/opened/signed/etc."},"lastInvitedAt":{"type":"string","format":"date-time","nullable":true},"signedAt":{"type":"string","format":"date-time","nullable":true},"receiptId":{"type":"string","nullable":true},"magicLinkUrl":{"type":"string","format":"uri","nullable":true}}},"EnrollmentAttachment":{"type":"object","additionalProperties":true,"properties":{"attachmentId":{"type":"string"},"filename":{"type":"string"},"size":{"type":"integer","minimum":0},"contentType":{"type":"string"},"uploadedAt":{"type":"string","format":"date-time"},"uploadedByFormId":{"type":"string","nullable":true}}},"EnrollmentInviteResult":{"type":"object","additionalProperties":true,"properties":{"sessionId":{"type":"string"},"scope":{"type":"string","description":"pending/all/etc."},"eligibleCount":{"type":"integer","minimum":0},"sent":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"failures":{"type":"array","items":{"type":"object","additionalProperties":true,"properties":{"formId":{"type":"string"},"reason":{"type":"string"}}}}}},"CustomOAuthConnection":{"type":"object","required":["id","provider_id","provider_name","provider_slug","status"],"properties":{"id":{"type":"string"},"provider_id":{"type":"string"},"provider_name":{"type":"string"},"provider_slug":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","error","expired"]},"external_account_id":{"type":"string","nullable":true},"external_account_name":{"type":"string","nullable":true},"external_account_email":{"type":"string","format":"email","nullable":true},"token_expires_at":{"type":"string","format":"date-time","nullable":true},"last_refreshed_at":{"type":"string","format":"date-time","nullable":true},"last_synced_at":{"type":"string","format":"date-time","nullable":true},"connected_at":{"type":"string","format":"date-time","nullable":true},"disconnected_at":{"type":"string","format":"date-time","nullable":true},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"CustomOAuthProviderConnection":{"type":"object","nullable":true,"required":["status"],"properties":{"status":{"type":"string"},"connected_at":{"type":"string","format":"date-time","nullable":true},"external_account_id":{"type":"string","nullable":true},"external_account_name":{"type":"string","nullable":true},"external_account_email":{"type":"string","format":"email","nullable":true}}},"CustomOAuthProvider":{"type":"object","required":["id","provider_name","provider_slug"],"properties":{"id":{"type":"string"},"provider_name":{"type":"string"},"provider_slug":{"type":"string"},"description":{"type":"string","nullable":true},"icon_url":{"type":"string","format":"uri","nullable":true},"auth_url":{"type":"string","format":"uri"},"token_url":{"type":"string","format":"uri"},"userinfo_url":{"type":"string","format":"uri","nullable":true},"revoke_url":{"type":"string","format":"uri","nullable":true},"scopes":{"type":"array","items":{"type":"string"}},"scope_separator":{"type":"string"},"additional_auth_params":{"type":"object","additionalProperties":{"type":"string"}},"additional_token_params":{"type":"object","additionalProperties":{"type":"string"}},"token_response_type":{"type":"string","enum":["json","form"]},"auth_method":{"type":"string","enum":["client_secret_post","client_secret_basic"]},"category":{"type":"string"},"is_active":{"type":"boolean"},"callbackUrl":{"type":"string","format":"uri"},"connection":{"$ref":"#/components/schemas/CustomOAuthProviderConnection"},"created_at":{"type":"string","format":"date-time","nullable":true},"updated_at":{"type":"string","format":"date-time","nullable":true}}},"CustomOAuthProviderCreate":{"type":"object","required":["providerName","authUrl","tokenUrl","clientId","clientSecret"],"properties":{"providerName":{"type":"string","minLength":2},"description":{"type":"string"},"iconUrl":{"type":"string","format":"uri"},"authUrl":{"type":"string","format":"uri"},"tokenUrl":{"type":"string","format":"uri"},"userinfoUrl":{"type":"string","format":"uri"},"revokeUrl":{"type":"string","format":"uri"},"clientId":{"type":"string","minLength":5},"clientSecret":{"type":"string","minLength":5,"format":"password","writeOnly":true},"scopes":{"type":"array","items":{"type":"string"}},"scopeSeparator":{"type":"string","default":" "},"additionalAuthParams":{"type":"object","additionalProperties":{"type":"string"}},"additionalTokenParams":{"type":"object","additionalProperties":{"type":"string"}},"tokenResponseType":{"type":"string","enum":["json","form"],"default":"json"},"authMethod":{"type":"string","enum":["client_secret_post","client_secret_basic"],"default":"client_secret_post"},"category":{"type":"string","default":"custom"}}},"CustomOAuthProviderUpdate":{"type":"object","minProperties":1,"properties":{"providerName":{"type":"string","minLength":2},"description":{"type":"string"},"iconUrl":{"type":"string","format":"uri"},"authUrl":{"type":"string","format":"uri"},"tokenUrl":{"type":"string","format":"uri"},"userinfoUrl":{"type":"string","format":"uri"},"revokeUrl":{"type":"string","format":"uri"},"clientId":{"type":"string","minLength":5},"clientSecret":{"type":"string","minLength":5,"format":"password","writeOnly":true},"scopes":{"type":"array","items":{"type":"string"}},"scopeSeparator":{"type":"string","default":" "},"additionalAuthParams":{"type":"object","additionalProperties":{"type":"string"}},"additionalTokenParams":{"type":"object","additionalProperties":{"type":"string"}},"tokenResponseType":{"type":"string","enum":["json","form"],"default":"json"},"authMethod":{"type":"string","enum":["client_secret_post","client_secret_basic"],"default":"client_secret_post"},"category":{"type":"string","default":"custom"},"isActive":{"type":"boolean"}}},"CustomOAuthProviderResponse":{"type":"object","required":["success","provider"],"properties":{"success":{"type":"boolean","enum":[true]},"provider":{"$ref":"#/components/schemas/CustomOAuthProvider"}}},"CustomOAuthProvidersResponse":{"type":"object","required":["success","providers"],"properties":{"success":{"type":"boolean","enum":[true]},"providers":{"type":"array","items":{"$ref":"#/components/schemas/CustomOAuthProvider"}}}},"CustomOAuthConnectionsResponse":{"type":"object","required":["success","connections"],"properties":{"success":{"type":"boolean","enum":[true]},"connections":{"type":"array","items":{"$ref":"#/components/schemas/CustomOAuthConnection"}}}},"CustomOAuthAuthorizationUrlResponse":{"type":"object","required":["success","provider","authorizationUrl","callbackUrl","configured"],"properties":{"success":{"type":"boolean","enum":[true]},"provider":{"type":"string"},"authorizationUrl":{"type":"string","format":"uri"},"callbackUrl":{"type":"string","format":"uri"},"configured":{"type":"boolean","enum":[true]}}},"CustomOAuthDeleteResponse":{"type":"object","required":["success","deleted"],"properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"object","required":["id","provider_name"],"properties":{"id":{"type":"string"},"provider_name":{"type":"string"}}}}},"CustomOAuthDisconnectResponse":{"type":"object","required":["success","disconnected"],"properties":{"success":{"type":"boolean","enum":[true]},"disconnected":{"type":"boolean","enum":[true]}}},"DocumentLibraryItem":{"type":"object","required":["id","docClass","filename"],"properties":{"id":{"type":"string"},"ownerUserId":{"type":"string","nullable":true},"ownerOrgId":{"type":"string","nullable":true},"ownerEmail":{"type":"string","format":"email","nullable":true},"folderId":{"type":"string","nullable":true},"folderName":{"type":"string","nullable":true},"docClass":{"type":"string"},"docType":{"type":"string","nullable":true},"filename":{"type":"string"},"mimeType":{"type":"string","nullable":true},"sizeBytes":{"type":"integer","format":"int64","nullable":true},"s3Bucket":{"type":"string","nullable":true},"s3Key":{"type":"string","nullable":true},"shareToken":{"type":"string","nullable":true},"urlPrefix":{"type":"string","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true},"viewCount":{"type":"integer"},"lastViewedAt":{"type":"string","format":"date-time","nullable":true},"metadata":{"type":"object","additionalProperties":true,"nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true}}},"DocumentFolder":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"ownerUserId":{"type":"string","nullable":true},"ownerOrgId":{"type":"string","nullable":true},"createdBy":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"color":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true},"deletedAt":{"type":"string","format":"date-time","nullable":true}}},"DocumentCasePickerItem":{"type":"object","required":["id","employerName"],"properties":{"id":{"type":"string"},"employerName":{"type":"string"},"updatedAt":{"type":"string","format":"date-time","nullable":true}}},"DocumentView":{"type":"object","required":["viewedAt"],"properties":{"viewedAt":{"type":"string","format":"date-time","nullable":true},"viewerUserId":{"type":"string","nullable":true},"viewerEmail":{"type":"string","format":"email","nullable":true},"ipAddress":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true}}},"DocumentUploadResponse":{"type":"object","required":["success","id","s3Key","expiresAt"],"properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string"},"s3Key":{"type":"string"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"artifactFamilyId":{"type":"string","nullable":true},"artifactVersion":{"type":"integer","minimum":1,"nullable":true}}},"DocumentListResponse":{"type":"object","required":["success","documents"],"properties":{"success":{"type":"boolean","enum":[true]},"documents":{"type":"array","items":{"$ref":"#/components/schemas/DocumentLibraryItem"}}}},"DocumentFoldersResponse":{"type":"object","required":["success","folders"],"properties":{"success":{"type":"boolean","enum":[true]},"folders":{"type":"array","items":{"$ref":"#/components/schemas/DocumentFolder"}}}},"DocumentFolderResponse":{"type":"object","required":["success","folder"],"properties":{"success":{"type":"boolean","enum":[true]},"folder":{"$ref":"#/components/schemas/DocumentFolder"}}},"DocumentCasesResponse":{"type":"object","required":["success","cases"],"properties":{"success":{"type":"boolean","enum":[true]},"cases":{"type":"array","items":{"$ref":"#/components/schemas/DocumentCasePickerItem"}}}},"DocumentViewsResponse":{"type":"object","required":["success","views"],"properties":{"success":{"type":"boolean","enum":[true]},"views":{"type":"array","items":{"$ref":"#/components/schemas/DocumentView"}}}},"DocumentUrlResponse":{"type":"object","required":["success","url"],"properties":{"success":{"type":"boolean","enum":[true]},"url":{"type":"string","format":"uri"}}},"DocumentShareResponse":{"type":"object","required":["success","token"],"properties":{"success":{"type":"boolean","enum":[true]},"token":{"type":"string"}}},"DocumentCaseAssignmentResponse":{"type":"object","required":["success","caseId","employerName"],"properties":{"success":{"type":"boolean","enum":[true]},"caseId":{"type":"string"},"employerName":{"type":"string"}}},"DocumentFolderCreateRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"scope":{"type":"string","enum":["user","org"],"default":"user"},"description":{"type":"string"},"color":{"type":"string"}}},"DocumentFolderUpdateRequest":{"type":"object","minProperties":1,"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"description":{"type":"string","nullable":true},"color":{"type":"string","nullable":true}}},"ExportRequest":{"type":"object","required":["format"],"properties":{"format":{"type":"string"},"destination":{"type":"string","default":"serverPDF"},"payload":{"type":"object","properties":{"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy"}},"additionalProperties":true},"caseId":{"type":"string"}}},"ExportQuota":{"type":"object","required":["count","limit","remaining"],"properties":{"count":{"type":"integer"},"limit":{"type":"integer"},"remaining":{"type":"integer"}}},"ExportQueuedResponse":{"type":"object","required":["id","status","destination","payloadSize"],"properties":{"id":{"type":"string"},"status":{"type":"string","enum":["queued"]},"destination":{"type":"string"},"payloadSize":{"type":"integer"},"exportQuota":{"$ref":"#/components/schemas/ExportQuota"}}},"ExportJobResponse":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string"},"status":{"type":"string"},"result":{"type":"object","additionalProperties":true,"nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true}}},"ExportAvailabilityResponse":{"type":"object","required":["available"],"properties":{"available":{"type":"boolean"}}},"PdfOptions":{"type":"object","properties":{"format":{"type":"string","default":"Letter"},"landscape":{"type":"boolean","default":false},"margin":{"type":"object","additionalProperties":{"type":"string"}},"professionalMode":{"type":"boolean","default":false},"showPageNumbers":{"type":"boolean","default":false},"preferCSSPageSize":{"type":"boolean"},"media":{"type":"string","enum":["screen","print"]},"fitContent":{"type":"boolean"},"tagged":{"type":"boolean","description":"Generate a tagged PDF structure tree for assistive technology."},"outline":{"type":"boolean","description":"Generate PDF document-outline bookmarks from semantic headings."},"metadata":{"type":"object","properties":{"title":{"type":"string"},"author":{"type":"string"},"subject":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}}}},"companyName":{"type":"string"}}},"PdfExportRequest":{"type":"object","required":["html"],"properties":{"html":{"type":"string"},"filename":{"type":"string","default":"report.pdf"},"options":{"$ref":"#/components/schemas/PdfOptions"},"caseId":{"type":"string"},"employerName":{"type":"string"},"persistArtifact":{"type":"object","additionalProperties":true,"nullable":true}}},"PdfFromUrlExportRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"filename":{"type":"string","default":"report.pdf"},"options":{"$ref":"#/components/schemas/PdfOptions"},"caseId":{"type":"string"}}},"EmailExportRequest":{"type":"object","required":["recipients"],"properties":{"recipients":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","format":"email"}},"subject":{"type":"string"},"message":{"type":"string"},"reportHtml":{"type":"string"},"reportData":{"type":"object","properties":{"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy"}},"additionalProperties":true},"attachPdf":{"type":"boolean","default":false},"caseId":{"type":"string"}}},"EmailExportResponse":{"type":"object","required":["success","recipientCount"],"properties":{"success":{"type":"boolean","enum":[true]},"messageId":{"type":"string","nullable":true},"recipientCount":{"type":"integer"},"hasPdfAttachment":{"type":"boolean"}}},"ExcelExportRequest":{"type":"object","required":["reportData"],"properties":{"reportData":{"type":"object","properties":{"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy"}},"additionalProperties":true},"filename":{"type":"string","default":"report.xlsx"},"options":{"type":"object","additionalProperties":true},"caseId":{"type":"string"}}},"JsonExportRequest":{"type":"object","required":["reportData"],"properties":{"reportData":{"type":"object","properties":{"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy"}},"additionalProperties":true},"filename":{"type":"string","default":"report.json"},"pretty":{"type":"boolean","default":true}}},"JsonExportResponse":{"type":"object","required":["exportedAt","exportVersion"],"properties":{"exportedAt":{"type":"string","format":"date-time"},"exportVersion":{"type":"string"},"exportedBy":{"type":"string","nullable":true}},"additionalProperties":true},"EmployeeCommunicationEmailRequest":{"type":"object","required":["html","recipients"],"properties":{"html":{"type":"string"},"recipients":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string","format":"email"}},"subject":{"type":"string"},"message":{"type":"string"},"attachPdf":{"type":"boolean","default":false},"filename":{"type":"string","default":"Benefits-Summary.pdf"},"employerName":{"type":"string","default":"Your Company"},"caseId":{"type":"string"}}},"WebhookRetryResponse":{"type":"object","required":["success","message","deliveryId"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"},"deliveryId":{"type":"string"}}},"WebhookRotateSecretResponse":{"type":"object","required":["success","message","secret","warning"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"},"secret":{"type":"string","writeOnly":true},"warning":{"type":"string"}}},"MarketResponseMeta":{"type":"object","properties":{"dataSource":{"type":"string"},"note":{"type":"string"},"surveyYear":{"type":"integer"},"lastUpdated":{"type":"string"},"period":{"type":"string"},"sampleSize":{"type":"integer"},"refreshedQuarter":{"type":"string"},"usingCustomKey":{"type":"boolean"},"yearsRequested":{"type":"integer"}},"additionalProperties":true},"MarketApiResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"},"data":{"oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"meta":{"$ref":"#/components/schemas/MarketResponseMeta"},"total":{"type":"integer"}}},"MarketPlanInput":{"type":"object","properties":{"name":{"type":"string"},"planName":{"type":"string"},"planType":{"type":"string"},"singlePremium":{"type":"number"},"premiumSingle":{"type":"number"},"familyPremium":{"type":"number"},"premiumFamily":{"type":"number"},"singleDeductible":{"type":"number"},"deductibleSingle":{"type":"number"},"familyDeductible":{"type":"number"},"deductibleFamily":{"type":"number"},"employerContributionPct":{"type":"number"},"erContributionPct":{"type":"number"},"employerPct":{"type":"number"},"premium":{"type":"object","additionalProperties":true},"deductible":{"type":"object","additionalProperties":true},"rates":{"type":"object","additionalProperties":true}},"additionalProperties":true},"MarketCompareRequest":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/MarketPlanInput"}},"zipCode":{"type":"string"},"zip":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"industry":{"type":"string"},"employeeCount":{"type":"integer","minimum":1},"employees":{"type":"integer","minimum":1},"size":{"type":"integer","minimum":1}}},"MarketBenchmarkRequest":{"type":"object","properties":{"industry":{"type":"string"},"sicCode":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"zipCode":{"type":"string"},"companySize":{"type":"string","enum":["small","medium","large","enterprise"]},"benefitTypes":{"type":"array","items":{"type":"string"}}}},"MarketBenchmarkMetric":{"type":"object","properties":{"avgPEPM":{"type":"number"},"avgEmployerContribution":{"type":"number"},"commonPlanTypes":{"type":"array","items":{"type":"string"}},"trends":{"type":"object","properties":{"yearOverYearChange":{"type":"number"},"projectedNextYear":{"type":"number"}}}},"additionalProperties":true},"MarketBenchmarkResponse":{"type":"object","required":["ok","benchmarks","filters","disclaimer","dataSource"],"properties":{"ok":{"type":"boolean","enum":[true]},"benchmarks":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/MarketBenchmarkMetric"}},"filters":{"type":"object","properties":{"industry":{"type":"string"},"sicCode":{"type":"string","nullable":true},"state":{"type":"string","nullable":true},"zipCode":{"type":"string","nullable":true},"companySize":{"type":"string"}}},"disclaimer":{"type":"string"},"dataSource":{"type":"string"}}},"MarketAiInsightsRequest":{"type":"object","required":["comparison"],"properties":{"comparison":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","minItems":1,"items":{"type":"object","additionalProperties":true}}},"additionalProperties":true},"employerName":{"type":"string"},"industry":{"type":"string"},"employeeCount":{"type":"integer","minimum":1},"rawPlans":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"MployerCompareRequest":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/MarketPlanInput"}},"zipCode":{"type":"string"},"zip":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"industry":{"type":"string"},"employeeCount":{"type":"integer","minimum":1},"employees":{"type":"integer","minimum":1},"size":{"type":"integer","minimum":1},"ein":{"type":"string"},"employerId":{"type":"string"}}},"MployerCompanySearchRequest":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"industry":{"type":"string"},"city":{"type":"string"},"zipCode":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerEmployerSearchRequest":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":1},"state":{"type":"string","minLength":2,"maxLength":2},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerPeoSearchRequest":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"ein":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerContactSearchRequest":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string","format":"email"},"employerId":{"type":"string"},"title":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerBrokerSearchRequest":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"city":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerCarrierSearchRequest":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"type":{"type":"string"},"limit":{"type":"integer","minimum":1,"maximum":100}}},"MployerInsightsRequest":{"type":"object","properties":{"employerName":{"type":"string"},"employerIndustry":{"type":"string"},"employerLocation":{"type":"string"},"employerSize":{"oneOf":[{"type":"integer","minimum":1},{"type":"string"}]},"fileType":{"type":"string","enum":["PDF","PowerPoint"],"default":"PDF"},"email":{"type":"string","format":"email"},"agentEmail":{"type":"string","format":"email"},"agentName":{"type":"string"}}},"CmsResponseMeta":{"type":"object","properties":{"dataSource":{"type":"string"},"note":{"type":"string"},"year":{"type":"integer"},"effectiveDate":{"type":"string","nullable":true},"usesTobacco":{"type":"boolean"}},"additionalProperties":true},"CmsApiResponse":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean"},"data":{"oneOf":[{"type":"object","additionalProperties":true},{"type":"array","items":{"type":"object","additionalProperties":true}}]},"meta":{"$ref":"#/components/schemas/CmsResponseMeta"}}},"CmsStatusResponse":{"type":"object","required":["ok","data"],"properties":{"ok":{"type":"boolean","enum":[true]},"data":{"type":"object","required":["configured","dataSource","features","documentation"],"properties":{"configured":{"type":"boolean"},"dataSource":{"type":"string"},"features":{"type":"array","items":{"type":"string"}},"documentation":{"type":"string","format":"uri"}}}}},"CmsSlcspRequest":{"type":"object","required":["zip","ages"],"properties":{"zip":{"type":"string","minLength":5,"maxLength":10},"ages":{"type":"array","minItems":1,"items":{"type":"integer","minimum":0,"maximum":120}},"year":{"type":"integer","minimum":2020},"income":{"type":"number","minimum":0}}},"CmsIchraAffordabilityRequest":{"type":"object","required":["zip","age","annualWage","monthlyContribution"],"properties":{"zip":{"type":"string","minLength":5,"maxLength":10},"age":{"type":"integer","minimum":18,"maximum":120},"annualWage":{"type":"number","exclusiveMinimum":true,"minimum":0},"monthlyContribution":{"type":"number","minimum":0},"year":{"type":"integer","minimum":2020},"uses_tobacco":{"type":"boolean","default":false},"householdIncome":{"type":"number","minimum":0}}},"CmsIchraEmployee":{"type":"object","required":["zip","age","annualWage"],"properties":{"zip":{"type":"string","minLength":5,"maxLength":10},"age":{"type":"integer","minimum":18,"maximum":120},"annualWage":{"type":"number","exclusiveMinimum":true,"minimum":0},"monthlyContribution":{"type":"number","minimum":0}}},"CmsIchraBulkRequest":{"type":"object","required":["employees"],"properties":{"employees":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/CmsIchraEmployee"}},"monthlyContribution":{"type":"number","minimum":0},"year":{"type":"integer","minimum":2020}}},"CmsHouseholdMember":{"type":"object","required":["age"],"properties":{"age":{"type":"integer","minimum":0,"maximum":120},"uses_tobacco":{"type":"boolean","default":false}}},"CmsPlanSearchRequest":{"type":"object","required":["zip"],"properties":{"zip":{"type":"string","minLength":5,"maxLength":10},"countyfips":{"type":"string"},"state":{"type":"string","minLength":2,"maxLength":2},"ages":{"type":"array","minItems":1,"items":{"type":"integer","minimum":0,"maximum":120}},"household":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/CmsHouseholdMember"}},"income":{"type":"number","minimum":0},"year":{"type":"integer","minimum":2020},"effective_date":{"type":"string","format":"date"},"uses_tobacco":{"type":"boolean","default":false},"fips":{"type":"string"},"filters":{"type":"object","additionalProperties":true},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50},"offset":{"type":"integer","minimum":0,"default":0}},"description":"Provide either `household` or the legacy `ages` array."},"CmsMetalLevel":{"type":"object","required":["name","actuarialValue","description"],"properties":{"name":{"type":"string"},"actuarialValue":{"type":"string"},"description":{"type":"string"},"typicalDeductible":{"type":"string"},"typicalOopMax":{"type":"string"},"note":{"type":"string"},"restrictions":{"type":"string"}}},"CmsMetalLevelsResponse":{"type":"object","required":["ok","data"],"properties":{"ok":{"type":"boolean","enum":[true]},"data":{"type":"object","required":["levels","acaOopMaxLimit"],"properties":{"levels":{"type":"array","items":{"$ref":"#/components/schemas/CmsMetalLevel"}},"acaOopMaxLimit":{"type":"object","required":["year","individual","family"],"properties":{"year":{"type":"integer"},"individual":{"type":"number"},"family":{"type":"number"},"note":{"type":"string"}}}}},"meta":{"$ref":"#/components/schemas/CmsResponseMeta"}}},"ParseOptions":{"type":"object","properties":{"forceAI":{"type":"boolean","description":"Skip deterministic extraction and use the configured AI parser."}}},"ParseBase64File":{"type":"object","required":["base64"],"properties":{"base64":{"type":"string","format":"byte"},"mimeType":{"type":"string"},"name":{"type":"string"}}},"ParseBase64Request":{"type":"object","anyOf":[{"required":["file"]},{"required":["data"]}],"description":"Base64 document request. Legacy clients may send data, mimeType, and fileName aliases instead of file.","properties":{"file":{"$ref":"#/components/schemas/ParseBase64File"},"kind":{"type":"string","default":"benefit"},"options":{"$ref":"#/components/schemas/ParseOptions"},"data":{"type":"string","format":"byte","description":"Legacy alias for file.base64."},"mimeType":{"type":"string","description":"Legacy alias for file.mimeType."},"fileName":{"type":"string","description":"Legacy alias for file.name."}}},"ParseRemoteRequest":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"kind":{"type":"string","default":"benefit"},"options":{"$ref":"#/components/schemas/ParseOptions"}}},"ParseExtractionInfo":{"type":"object","description":"Stable extraction metadata with parser-specific metadata allowed.","properties":{"source":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1},"cost":{"type":"number","minimum":0},"carrier":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true},"planType":{"type":"string","nullable":true},"pageCount":{"type":"integer","minimum":0}},"additionalProperties":true},"ParseV1Data":{"type":"object","required":["kind","fileName","benefits","plans","totals","provenance","extraction"],"properties":{"kind":{"type":"string"},"fileName":{"type":"string"},"benefits":{"type":"object","description":"Parser-specific benefit fields.","additionalProperties":true},"plans":{"type":"array","description":"Parser-specific plan payloads.","items":{"type":"object","description":"A normalized plan whose available fields depend on the source document.","additionalProperties":true}},"totals":{"type":"object","description":"Parser-specific aggregate values.","additionalProperties":true},"provenance":{"type":"array","items":{"type":"object","description":"Source provenance for a parsed field or document segment.","additionalProperties":true}},"extraction":{"$ref":"#/components/schemas/ParseExtractionInfo"}}},"ParseV1Response":{"type":"object","required":["ok","data","requestId","durationMs"],"properties":{"ok":{"type":"boolean","enum":[true]},"data":{"$ref":"#/components/schemas/ParseV1Data"},"requestId":{"type":"string"},"durationMs":{"type":"integer","minimum":0}}},"ParseServiceState":{"type":"object","required":["enabled","ready"],"properties":{"enabled":{"type":"boolean"},"ready":{"type":"boolean"},"region":{"type":"string"},"s3Bucket":{"type":"string","nullable":true},"budgetExceeded":{"type":"boolean"},"model":{"type":"string"},"hourlyBudget":{"type":"string"},"dailyBudget":{"type":"string"},"error":{"type":"string"}}},"ParseFormatSupport":{"type":"object","required":["supported","parser"],"properties":{"supported":{"type":"boolean"},"parser":{"type":"string","nullable":true},"aiEnhanced":{"type":"boolean"},"ocrSupport":{"type":"boolean"},"useCase":{"type":"string"},"note":{"type":"string"}}},"ParseEndpointDescriptor":{"type":"object","required":["method","formats","auth"],"properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"formats":{"type":"array","items":{"type":"string"}},"auth":{"type":"boolean"},"ai":{"type":"boolean"},"ocr":{"type":"boolean"}}},"ParseStatusResponse":{"type":"object","required":["ok","timestamp","parsers","libraries","aws","formats","carrierParsers","endpoints","summary"],"properties":{"ok":{"type":"boolean","enum":[true]},"timestamp":{"type":"string","format":"date-time"},"parsers":{"type":"object","additionalProperties":{"type":"boolean"}},"libraries":{"type":"object","additionalProperties":{"type":"boolean"}},"aws":{"type":"object","required":["textract","bedrock"],"properties":{"textract":{"$ref":"#/components/schemas/ParseServiceState"},"bedrock":{"$ref":"#/components/schemas/ParseServiceState"}}},"formats":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ParseFormatSupport"}},"carrierParsers":{"type":"array","items":{"type":"string"}},"endpoints":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ParseEndpointDescriptor"}}},"summary":{"type":"object","required":["supportedFormats","missingFormats","aiEnabled","ocrEnabled"],"properties":{"supportedFormats":{"type":"array","items":{"type":"string"}},"missingFormats":{"type":"array","items":{"type":"string"}},"aiEnabled":{"type":"boolean"},"ocrEnabled":{"type":"boolean"}}}}},"UnifiedParseHealthResponse":{"type":"object","required":["ok","status","parserCount","parsers"],"properties":{"ok":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["healthy"]},"parserCount":{"type":"integer","minimum":0},"parsers":{"type":"array","items":{"type":"string"}}}},"ParseDocumentUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","peo","self-insured"],"default":"medical"},"includeRawText":{"type":"boolean","default":false}}},"ParseQuoteUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","peo","self-insured"],"default":"medical"},"includeRawText":{"type":"boolean","default":false},"useAIFallback":{"type":"boolean","default":true},"pdfLinkAnnotations":{"type":"string","description":"JSON-encoded array of link annotations extracted from the source PDF."}}},"ParseSpreadsheetUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"dataType":{"type":"string","enum":["rates","census","benefits","auto"],"default":"auto"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","peo","self-insured"],"default":"medical"}}},"ParseImageUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"extractBenefits":{"type":"boolean","default":false}}},"ParseXmlUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"format":{"type":"string","enum":["auto","acord","generic"],"default":"auto"}}},"ParseCensusUploadRequest":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary"},"mappingContext":{"type":"string","description":"JSON-encoded deterministic parser context containing headers, sample rows, and local mapping."},"additionalInstructions":{"type":"string","maxLength":2000,"description":"Optional user guidance for ambiguous vendor-specific column labels."}}},"ParsePlansResponse":{"type":"object","required":["ok","plans","durationMs","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"plans":{"type":"array","description":"Parser-specific plan payloads.","items":{"type":"object","description":"A normalized plan whose available fields depend on the source document.","additionalProperties":true}},"carrier":{"type":"string","nullable":true},"source":{"type":"string"},"summary":{"type":"object","description":"Parser-specific invoice summary.","additionalProperties":true},"extraction":{"$ref":"#/components/schemas/ParseExtractionInfo"},"rawText":{"type":"string"},"confidence":{"type":"number","minimum":0,"maximum":1},"aiCost":{"type":"number","minimum":0},"usedAIFallback":{"type":"boolean"},"durationMs":{"type":"integer","minimum":0},"requestId":{"type":"string"}}},"ParseSbcResponse":{"type":"object","required":["ok","isSBC","benefits","carrier","planName","durationMs","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"isSBC":{"type":"boolean"},"benefits":{"type":"object","description":"Parser-specific SBC benefit fields.","additionalProperties":true,"nullable":true},"carrier":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true},"source":{"type":"string"},"extraction":{"$ref":"#/components/schemas/ParseExtractionInfo"},"rawText":{"type":"string"},"durationMs":{"type":"integer","minimum":0},"requestId":{"type":"string"}}},"ParseSpreadsheetResponse":{"type":"object","required":["ok","dataType","headers","rowCount","data","totalRows","sheets","durationMs","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"dataType":{"type":"string","enum":["rates","census","benefits","unknown"]},"headers":{"type":"array","items":{"type":"string"}},"rowCount":{"type":"integer","minimum":0},"data":{"type":"array","maxItems":100,"items":{"type":"object","description":"Spreadsheet row keyed by source column header.","additionalProperties":true}},"totalRows":{"type":"integer","minimum":0},"sheets":{"type":"array","items":{"type":"string"}},"durationMs":{"type":"integer","minimum":0},"requestId":{"type":"string"}}},"ParseImageResponse":{"type":"object","required":["ok","ocrSource","text","textLength","tables","benefits","durationMs","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"ocrSource":{"type":"string","enum":["textract","tesseract","none"]},"text":{"type":"string"},"textLength":{"type":"integer","minimum":0},"tables":{"type":"array","items":{"type":"object","description":"OCR table representation returned by the active engine.","additionalProperties":true}},"benefits":{"type":"object","description":"Benefit data extracted from OCR text when requested.","additionalProperties":true,"nullable":true},"durationMs":{"type":"integer","minimum":0},"requestId":{"type":"string"}}},"ParseXmlResponse":{"type":"object","required":["ok","format","data","rawLength","durationMs","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"format":{"type":"string","enum":["acord","edi","generic"]},"data":{"type":"object","description":"Parsed XML tree.","additionalProperties":true},"rawLength":{"type":"integer","minimum":0},"durationMs":{"type":"integer","minimum":0},"requestId":{"type":"string"}}},"CensusColumnMapping":{"type":"object","required":["format"],"properties":{"format":{"type":"string","enum":["wide","long"]},"firstName":{"type":"integer","minimum":-1},"lastName":{"type":"integer","minimum":-1},"fullName":{"type":"integer","minimum":-1},"dob":{"type":"integer","minimum":-1},"gender":{"type":"integer","minimum":-1},"zip":{"type":"integer","minimum":-1},"city":{"type":"integer","minimum":-1},"county":{"type":"integer","minimum":-1},"metro":{"type":"integer","minimum":-1},"residenceState":{"type":"integer","minimum":-1},"worksiteState":{"type":"integer","minimum":-1},"state":{"type":"integer","minimum":-1},"worksite":{"type":"integer","minimum":-1},"department":{"type":"integer","minimum":-1},"employmentClass":{"type":"integer","minimum":-1},"coverageTier":{"type":"integer","minimum":-1},"relationship":{"type":"integer","minimum":-1},"waiverReason":{"type":"integer","minimum":-1},"employmentStatus":{"type":"integer","minimum":-1},"employmentType":{"type":"integer","minimum":-1},"hoursPerWeek":{"type":"integer","minimum":-1},"hireDate":{"type":"integer","minimum":-1},"cobra":{"type":"integer","minimum":-1},"salary":{"type":"integer","minimum":-1},"benefitTypeColumn":{"type":"integer","minimum":-1},"longPlanColumn":{"type":"integer","minimum":-1},"longTierColumn":{"type":"integer","minimum":-1},"elections":{"type":"object","description":"Benefit-type election column mappings.","additionalProperties":true},"dependentSlots":{"type":"array","items":{"type":"object","description":"Dependent slot column indexes.","additionalProperties":true}}},"additionalProperties":true},"CensusMappingProposal":{"type":"object","required":["mode","mapping","columnMappingConfidence"],"properties":{"mode":{"type":"string","enum":["mapping"]},"vendor":{"type":"string"},"formatVersion":{"type":"string"},"mapping":{"$ref":"#/components/schemas/CensusColumnMapping"},"columnMappingConfidence":{"type":"number","minimum":0,"maximum":100},"warnings":{"type":"array","items":{"type":"string"}},"rationale":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"ParseCensusResponse":{"type":"object","required":["ok"],"description":"Census mapping proposal, or a structured disabled response when AI parsing is unavailable by policy.","properties":{"ok":{"type":"boolean"},"disabled":{"type":"boolean"},"reason":{"type":"string","enum":["ai_parsing_disabled"]},"message":{"type":"string"},"mode":{"type":"string","enum":["mapping"]},"mappingProposal":{"$ref":"#/components/schemas/CensusMappingProposal"},"detectedFormat":{"type":"string","enum":["wide","long"]},"columnMappingConfidence":{"type":"number","minimum":0,"maximum":100},"warnings":{"type":"array","items":{"type":"string"}},"meta":{"type":"object","required":["requestId","durationMs","source","rowCount","fingerprint","model"],"properties":{"requestId":{"type":"string"},"durationMs":{"type":"integer","minimum":0},"source":{"type":"string","enum":["ai-mapping"]},"rowCount":{"type":"integer","minimum":0},"fingerprint":{"type":"string"},"model":{"type":"string"},"inputTokens":{"type":"integer","minimum":0},"outputTokens":{"type":"integer","minimum":0}}}}},"RagCaseGroundingPreference":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}},"RagCaseIndexStatus":{"type":"string","enum":["ready_with_results","ready_no_match","indexing","stale","not_indexed","disabled","degraded"]},"RagCaseIndexQueueState":{"type":"string","enum":["idle","pending","retrying","processing","failed"]},"RagCaseIndexQueue":{"type":"object","additionalProperties":false,"required":["state","pending","retrying","processing","failed","maxAttempts","oldestEnqueuedAt"],"properties":{"state":{"$ref":"#/components/schemas/RagCaseIndexQueueState"},"pending":{"type":"integer","minimum":0,"maximum":1000000},"retrying":{"type":"integer","minimum":0,"maximum":1000000},"processing":{"type":"integer","minimum":0,"maximum":1000000},"failed":{"type":"integer","minimum":0,"maximum":1000000},"maxAttempts":{"type":"integer","minimum":0,"maximum":5},"oldestEnqueuedAt":{"type":"string","format":"date-time","nullable":true}}},"RagCaseIndexedEntities":{"type":"object","additionalProperties":false,"required":["total","plans","contributions","census","notes","sourceDocuments","metadata"],"properties":{"total":{"type":"integer","minimum":0,"maximum":1000000},"plans":{"type":"integer","minimum":0,"maximum":1000000},"contributions":{"type":"integer","minimum":0,"maximum":1000000},"census":{"type":"integer","minimum":0,"maximum":1000000},"notes":{"type":"integer","minimum":0,"maximum":1000000},"sourceDocuments":{"type":"integer","minimum":0,"maximum":1000000},"metadata":{"type":"integer","minimum":0,"maximum":1000000}}},"RagCaseIndexStatusResponse":{"type":"object","additionalProperties":false,"required":["success","version","caseId","owned","status","caseUpdatedAt","lastIndexedAt","freshness","queue","indexedEntities","sourceDocuments","refresh"],"properties":{"success":{"type":"boolean","enum":[true]},"version":{"type":"integer","enum":[1]},"caseId":{"type":"string"},"owned":{"type":"boolean","enum":[true]},"status":{"$ref":"#/components/schemas/RagCaseIndexStatus"},"caseUpdatedAt":{"type":"string","format":"date-time","nullable":true},"lastIndexedAt":{"type":"string","format":"date-time","nullable":true},"freshness":{"type":"object","additionalProperties":false,"required":["isCurrent","basis"],"properties":{"isCurrent":{"type":"boolean"},"basis":{"type":"string","enum":["timestamp"]}}},"queue":{"$ref":"#/components/schemas/RagCaseIndexQueue"},"indexedEntities":{"$ref":"#/components/schemas/RagCaseIndexedEntities"},"sourceDocuments":{"type":"object","additionalProperties":false,"required":["available","chunkCount"],"properties":{"available":{"type":"boolean"},"chunkCount":{"type":"integer","minimum":0,"maximum":1000000}}},"refresh":{"type":"object","additionalProperties":false,"required":["available","reason"],"properties":{"available":{"type":"boolean"},"reason":{"type":"string","enum":["available","already_indexing","current","disabled","over_budget","retry_exhausted"]}}}}},"RagCaseIndexRefreshResponse":{"type":"object","additionalProperties":false,"required":["success","version","caseId","queued","deduplicated","status","requestedAt","queue"],"properties":{"success":{"type":"boolean","enum":[true]},"version":{"type":"integer","enum":[1]},"caseId":{"type":"string"},"queued":{"type":"boolean","enum":[true]},"deduplicated":{"type":"boolean"},"status":{"type":"string","enum":["indexing"]},"requestedAt":{"type":"string","format":"date-time","nullable":true},"queue":{"type":"object","additionalProperties":false,"required":["state","attempts"],"properties":{"state":{"$ref":"#/components/schemas/RagCaseIndexQueueState"},"attempts":{"type":"integer","minimum":0,"maximum":5}}}}},"RagCaseIndexError":{"type":"object","additionalProperties":false,"required":["success","code","message"],"properties":{"success":{"type":"boolean","enum":[false]},"code":{"type":"string","enum":["INVALID_CASE_ID","CASE_NOT_FOUND","RAG_DISABLED","AI_BUDGET_EXCEEDED","CASE_INDEX_RETRY_EXHAUSTED","CASE_INDEX_REFRESH_NOT_NEEDED","RATE_LIMIT_EXCEEDED","CASE_INDEX_STATUS_FAILED"]},"message":{"type":"string"}}},"RagCaseIndexScopeError":{"type":"object","additionalProperties":false,"required":["success","error","message","requiredScopes","availableScopes"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string","enum":["insufficient_scope"]},"message":{"type":"string"},"requiredScopes":{"type":"array","items":{"type":"string"},"maxItems":4},"availableScopes":{"type":"array","items":{"type":"string"},"maxItems":100}}},"RagCaseFocus":{"type":"object","properties":{"benefitTab":{"type":"string","nullable":true},"selectedPlanId":{"type":"string","nullable":true},"selectedPlanName":{"type":"string","nullable":true},"selectedPlanCarrier":{"type":"string","nullable":true},"selectedPlanDesignation":{"type":"string","nullable":true},"activeScenarioId":{"type":"string","nullable":true},"activeScenarioName":{"type":"string","nullable":true},"activeScenarioBenefitType":{"type":"string","nullable":true},"documentId":{"type":"string","nullable":true},"documentName":{"type":"string","nullable":true}}},"RagQueryRequest":{"type":"object","required":["query"],"properties":{"query":{"type":"string","minLength":1},"includeCase":{"type":"boolean","default":false},"scopeBoosts":{"type":"array","description":"Shared-corpus scope tags whose matching chunks receive a score boost.","items":{"type":"string"}},"topK":{"type":"integer","minimum":1,"default":8},"caseId":{"type":"string"},"caseOnly":{"type":"boolean","default":false,"description":"When includeCase is true, omit shared code and help chunks."},"caseFocus":{"$ref":"#/components/schemas/RagCaseFocus"},"scope":{"$ref":"#/components/schemas/RagCaseFocus","description":"Legacy alias for caseFocus."}}},"RagChunk":{"type":"object","required":["id","corpus","chunk_text","score","citation"],"properties":{"id":{"type":"integer"},"corpus":{"type":"string","enum":["code","help","case"]},"source_path":{"type":"string","nullable":true},"symbol":{"type":"string","nullable":true},"publishes_window":{"type":"string","nullable":true},"line_start":{"type":"integer","nullable":true},"line_end":{"type":"integer","nullable":true},"chunk_text":{"type":"string"},"jsdoc_summary":{"type":"string","nullable":true},"source_page":{"type":"integer","nullable":true},"source_snippet":{"type":"string","nullable":true},"score":{"type":"number"},"citation":{"type":"string"}}},"RagQueryResponse":{"type":"object","required":["chunks"],"description":"Retrieved chunks. A disabled or degraded response returns an empty chunk list with its reason.","properties":{"success":{"type":"boolean"},"disabled":{"type":"boolean"},"degraded":{"type":"boolean"},"reason":{"type":"string","enum":["ai_rag_disabled","rag_unavailable"]},"chunks":{"type":"array","items":{"$ref":"#/components/schemas/RagChunk"}},"total_ms":{"type":"integer","minimum":0},"rag_event_id":{"type":"integer","nullable":true}}},"ParseEngineState":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}},"ParseEnginesResponse":{"type":"object","required":["ok","engines","requestId"],"properties":{"ok":{"type":"boolean","enum":[true]},"engines":{"type":"object","required":["azure","docai","pdf"],"properties":{"azure":{"$ref":"#/components/schemas/ParseEngineState"},"docai":{"$ref":"#/components/schemas/ParseEngineState"},"pdf":{"$ref":"#/components/schemas/ParseEngineState"}}},"requestId":{"type":"string"}}},"EnrollmentPdfField":{"type":"object","required":["name","type"],"properties":{"name":{"type":"string"},"type":{"type":"string","enum":["Text","Checkbox","Dropdown","RadioGroup","Unknown"]}}},"EnrollmentExtractFieldsUploadRequest":{"type":"object","description":"Provide one PDF source.","properties":{"pdf":{"type":"string","format":"binary"},"pdfBase64":{"type":"string","format":"byte"},"pdfS3Key":{"type":"string"}},"anyOf":[{"required":["pdf"]},{"required":["pdfBase64"]},{"required":["pdfS3Key"]}]},"EnrollmentExtractFieldsJsonRequest":{"type":"object","properties":{"pdfBase64":{"type":"string","format":"byte"},"pdfS3Key":{"type":"string"}},"anyOf":[{"required":["pdfBase64"]},{"required":["pdfS3Key"]}]},"EnrollmentExtractFieldsResponse":{"type":"object","required":["success","fieldCount","fields"],"properties":{"success":{"type":"boolean","enum":[true]},"fieldCount":{"type":"integer","minimum":0},"fields":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentPdfField"}}}},"EnrollmentAutoMatchRequest":{"type":"object","required":["pdfFields","spreadsheetHeaders"],"properties":{"pdfFields":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/EnrollmentPdfField"}},"spreadsheetHeaders":{"type":"array","minItems":1,"items":{"type":"string"}}}},"EnrollmentAutoMatchResponse":{"type":"object","required":["success","mapping","stats"],"properties":{"success":{"type":"boolean","enum":[true]},"mapping":{"type":"object","description":"Map from PDF field name to matched spreadsheet header or null.","additionalProperties":{"type":"string","nullable":true}},"stats":{"type":"object","required":["total","matched","unmatched"],"properties":{"total":{"type":"integer","minimum":0},"matched":{"type":"integer","minimum":0},"unmatched":{"type":"integer","minimum":0}}}}},"EnrollmentBatchOptions":{"type":"object","properties":{"filenamePattern":{"type":"string","default":"{lastName}_{firstName}_enrollment"},"computedFields":{"type":"object","description":"Map from PDF field name to a formula string.","additionalProperties":{"type":"string"}},"customCheckboxMappings":{"type":"object","description":"Checkbox true/false value configuration by field.","additionalProperties":true},"multiValueCheckboxGroups":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"fieldValidationRules":{"type":"object","description":"Map from PDF field name to validation rule: email, phone, ssn, zip, or date.","additionalProperties":{"type":"string"}}}},"EnrollmentBatchUploadRequest":{"type":"object","description":"Multipart batch input. Provide one PDF source and one employee-data source.","properties":{"pdf":{"type":"string","format":"binary"},"data":{"type":"string","format":"binary"},"pdfBase64":{"type":"string","format":"byte"},"pdfS3Key":{"type":"string"},"dataBase64":{"type":"string","format":"byte"},"dataFilename":{"type":"string"},"dataS3Key":{"type":"string"},"rows":{"type":"string","description":"JSON-encoded array of employee row objects."},"mapping":{"type":"string","description":"JSON-encoded map from PDF fields to spreadsheet columns."},"options":{"type":"string","description":"JSON-encoded EnrollmentBatchOptions object."}},"allOf":[{"anyOf":[{"required":["pdf"]},{"required":["pdfBase64"]},{"required":["pdfS3Key"]}]},{"anyOf":[{"required":["data"]},{"required":["dataBase64"]},{"required":["dataS3Key"]},{"required":["rows"]}]}]},"EnrollmentBatchJsonRequest":{"type":"object","properties":{"pdfBase64":{"type":"string","format":"byte"},"pdfS3Key":{"type":"string"},"dataBase64":{"type":"string","format":"byte"},"dataFilename":{"type":"string"},"dataS3Key":{"type":"string"},"rows":{"type":"array","items":{"type":"object","description":"Employee row keyed by source spreadsheet header.","additionalProperties":true}},"mapping":{"type":"object","description":"Map from PDF fields to spreadsheet columns or mapping options.","additionalProperties":true},"options":{"$ref":"#/components/schemas/EnrollmentBatchOptions"}},"allOf":[{"anyOf":[{"required":["pdfBase64"]},{"required":["pdfS3Key"]}]},{"anyOf":[{"required":["dataBase64"]},{"required":["dataS3Key"]},{"required":["rows"]}]}]},"EnrollmentBatchStats":{"type":"object","required":["total","success","failed","warnings"],"properties":{"total":{"type":"integer","minimum":0},"success":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"warnings":{"type":"integer","minimum":0}}},"EnrollmentValidationError":{"type":"object","required":["field","value","message"],"properties":{"field":{"type":"string"},"value":{"type":"string"},"message":{"type":"string"}}},"EnrollmentValidationWarning":{"type":"object","required":["index","filename","errors"],"properties":{"index":{"type":"integer","minimum":0},"filename":{"type":"string"},"errors":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentValidationError"}}}},"EnrollmentBatchError":{"type":"object","required":["index","row","message"],"properties":{"index":{"type":"integer","minimum":0},"row":{"type":"integer","minimum":1},"message":{"type":"string"}}},"EnrollmentBatchProcessResponse":{"type":"object","required":["success","stats","processingTimeMs","zipBase64","validationWarnings","errors"],"properties":{"success":{"type":"boolean","enum":[true]},"stats":{"$ref":"#/components/schemas/EnrollmentBatchStats"},"processingTimeMs":{"type":"integer","minimum":0},"zipBase64":{"type":"string","format":"byte"},"validationWarnings":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentValidationWarning"}},"errors":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentBatchError"}}}},"EnrollmentBatchJobCreatedResponse":{"type":"object","required":["success","jobId","status","totalRows","statusUrl"],"properties":{"success":{"type":"boolean","enum":[true]},"jobId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending"]},"totalRows":{"type":"integer","minimum":1},"statusUrl":{"type":"string"}}},"EnrollmentBatchProgress":{"type":"object","required":["current","total"],"properties":{"current":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}}},"EnrollmentBatchJobResult":{"type":"object","required":["stats","processingTimeMs","validationWarnings","errors"],"properties":{"stats":{"$ref":"#/components/schemas/EnrollmentBatchStats"},"processingTimeMs":{"type":"integer","minimum":0},"validationWarnings":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentValidationWarning"}},"errors":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentBatchError"}}}},"EnrollmentBatchJobResponse":{"type":"object","required":["id","status","progress","createdAt","updatedAt","error","downloadUrl"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","processing","completed","failed"]},"progress":{"$ref":"#/components/schemas/EnrollmentBatchProgress"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"result":{"$ref":"#/components/schemas/EnrollmentBatchJobResult"},"error":{"type":"string","nullable":true},"downloadUrl":{"type":"string","nullable":true}}},"EnrollmentBatchJobSummary":{"type":"object","required":["id","status","progress","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","processing","completed","failed"]},"progress":{"$ref":"#/components/schemas/EnrollmentBatchProgress"},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time"},"stats":{"$ref":"#/components/schemas/EnrollmentBatchStats"}}},"EnrollmentBatchJobsResponse":{"type":"object","required":["jobs","total"],"properties":{"jobs":{"type":"array","maxItems":50,"items":{"$ref":"#/components/schemas/EnrollmentBatchJobSummary"}},"total":{"type":"integer","minimum":0}}},"EnrollmentBatchDeleteResponse":{"type":"object","required":["success","deleted"],"properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"type":"string","format":"uuid"}}},"EnrollmentFieldMapping":{"type":"object","description":"PDF field mapping. Values may be spreadsheet column names or mapping option objects.","additionalProperties":true},"EnrollmentMappingCreateRequest":{"type":"object","required":["pdfHash","mapping","name"],"properties":{"pdfHash":{"type":"string","minLength":1,"maxLength":64},"mapping":{"$ref":"#/components/schemas/EnrollmentFieldMapping"},"name":{"type":"string","minLength":1,"maxLength":255}}},"EnrollmentMappingRecord":{"type":"object","required":["id","name","mapping","createdAt","userId"],"properties":{"id":{"type":"integer","minimum":1},"name":{"type":"string"},"mapping":{"$ref":"#/components/schemas/EnrollmentFieldMapping"},"createdAt":{"type":"string","format":"date-time"},"userId":{"type":"integer"}}},"EnrollmentMappingsResponse":{"type":"object","required":["success","mappings"],"properties":{"success":{"type":"boolean","enum":[true]},"mappings":{"type":"array","maxItems":50,"items":{"$ref":"#/components/schemas/EnrollmentMappingRecord"}}}},"EnrollmentMappingSavedResponse":{"type":"object","required":["success","id"],"properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"integer","minimum":1}}},"EnrollmentMappingDeletedResponse":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}},"PlanLibraryCreateResponse":{"type":"object","required":["ok","item"],"properties":{"ok":{"type":"boolean","enum":[true]},"item":{"$ref":"#/components/schemas/PlanLibraryItem"}}},"BulkReparseFilterRequest":{"type":"object","properties":{"carrier":{"type":"string"},"benefitType":{"type":"string"},"planIds":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer","minimum":1},"fetchDocuments":{"type":"boolean","default":false},"overrideS3Key":{"type":"string","nullable":true},"orgId":{"type":"string"}}},"BulkReparseBenefitValues":{"type":"object","description":"Normalized benefit values keyed by canonical benefit field ID.","additionalProperties":{"type":"string"}},"BulkReparseChange":{"type":"object","required":["key","label","current","proposed"],"properties":{"key":{"type":"string"},"label":{"type":"string"},"current":{"type":"string"},"proposed":{"type":"string"}}},"BulkReparseComparison":{"type":"object","required":["changes","unchanged","added","removed"],"properties":{"changes":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseChange"}},"unchanged":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseChange"}},"added":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseChange"}},"removed":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseChange"}}}},"BulkReparseEnrollmentAndRates":{"type":"object","description":"Premium structures extracted from the plan. Tier, volume-rate, and age-band shapes vary by benefit type.","properties":{"tiers":{"type":"array","items":{"type":"object","description":"Tier enrollment and rate values.","additionalProperties":true}},"volumeRates":{"description":"Volume-rate structure; shape varies by benefit type.","nullable":true},"ageBands":{"description":"Age-band structure; shape varies by carrier.","nullable":true},"rateStructure":{"type":"string","nullable":true}}},"BulkReparsePlanResult":{"type":"object","required":["name","carrier","benefitType","index","currentBenefits","proposedBenefits","comparison","status","error","hasChanges","sourceFiles","possibleS3Keys","s3Key"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"carrier":{"type":"string"},"benefitType":{"type":"string"},"index":{"type":"integer","minimum":0},"currentBenefits":{"$ref":"#/components/schemas/BulkReparseBenefitValues"},"proposedBenefits":{"$ref":"#/components/schemas/BulkReparseBenefitValues"},"comparison":{"$ref":"#/components/schemas/BulkReparseComparison"},"status":{"type":"string","enum":["pending","pending_reparse","skipped","processed","error"]},"error":{"type":"string","nullable":true},"hasChanges":{"type":"boolean"},"sourceFiles":{"description":"Source filenames or source-file metadata.","oneOf":[{"type":"array","items":{"description":"Source filename or source-file metadata."}},{"type":"string"}]},"possibleS3Keys":{"type":"array","items":{"type":"string"}},"s3Key":{"type":"string","nullable":true},"currentHash":{"type":"string"},"proposedHash":{"type":"string"},"usedOverride":{"type":"boolean"},"currentEnrollmentAndRates":{"$ref":"#/components/schemas/BulkReparseEnrollmentAndRates"},"proposedEnrollmentAndRates":{"$ref":"#/components/schemas/BulkReparseEnrollmentAndRates"}}},"BulkReparseDiscoveredPlan":{"type":"object","required":["benefitType","benefits","tiers","_source"],"properties":{"planName":{"type":"string"},"carrier":{"type":"string"},"benefitType":{"type":"string"},"benefits":{"type":"object","description":"Parser-specific benefit fields.","additionalProperties":true},"tiers":{"type":"array","items":{"type":"object","description":"Parser-specific tier fields.","additionalProperties":true}},"enrollmentAndRates":{"type":"object","description":"Parser-specific premium structures.","additionalProperties":true,"nullable":true},"volumeRates":{"description":"Parser-specific volume rates.","nullable":true},"ageBands":{"description":"Parser-specific age bands.","nullable":true},"_source":{"type":"string","enum":["bulk-reparse-discovered"]}}},"BulkReparseSummary":{"type":"object","required":["totalInLibrary","filtered","processed","withChanges","skipped","errors","discoveredNewPlanCount"],"properties":{"totalInLibrary":{"type":"integer","minimum":0},"filtered":{"type":"integer","minimum":0},"processed":{"type":"integer","minimum":0},"withChanges":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"errors":{"type":"integer","minimum":0},"discoveredNewPlanCount":{"type":"integer","minimum":0}}},"BulkReparseReport":{"type":"object","required":["generated","mode","filters","summary","plans","discoveredNewPlans"],"properties":{"generated":{"type":"string","format":"date-time"},"mode":{"type":"string","enum":["quick-preview","full-reparse"]},"filters":{"$ref":"#/components/schemas/BulkReparseFilterRequest"},"summary":{"$ref":"#/components/schemas/BulkReparseSummary"},"plans":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparsePlanResult"}},"discoveredNewPlans":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseDiscoveredPlan"}}}},"BulkReparseSingleRequest":{"type":"object","required":["planId"],"properties":{"planId":{"type":"string"},"orgId":{"type":"string"}}},"BulkReparsePlanUpdate":{"type":"object","required":["id","finalBenefits"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"finalBenefits":{"$ref":"#/components/schemas/BulkReparseBenefitValues"},"finalEnrollmentAndRates":{"$ref":"#/components/schemas/BulkReparseEnrollmentAndRates"}}},"BulkReparseApplyRequest":{"type":"object","required":["plans"],"properties":{"plans":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparsePlanUpdate"}},"orgId":{"type":"string"},"applyAsNewSource":{"type":"boolean","default":false},"overrideS3Key":{"type":"string","nullable":true}}},"BulkReparseUpdateLogEntry":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["not_found","updated_db","db_failed_local_backup","db_error","updated_local"]},"error":{"type":"string"}}},"BulkReparseApplyResponse":{"type":"object","required":["success","updatedCount","dbUpdatedCount","backupPath","updateLog","storageMode"],"properties":{"success":{"type":"boolean","enum":[true]},"updatedCount":{"type":"integer","minimum":0},"dbUpdatedCount":{"type":"integer","minimum":0},"backupPath":{"type":"string","nullable":true},"updateLog":{"type":"array","items":{"$ref":"#/components/schemas/BulkReparseUpdateLogEntry"}},"storageMode":{"type":"string","enum":["cloud","local"]}}},"BulkReparseStatsResponse":{"type":"object","required":["total","byCarrier","byType","withSourceFiles","withoutSourceFiles"],"properties":{"total":{"type":"integer","minimum":0},"byCarrier":{"type":"object","additionalProperties":{"type":"integer","minimum":0}},"byType":{"type":"object","additionalProperties":{"type":"integer","minimum":0}},"withSourceFiles":{"type":"integer","minimum":0},"withoutSourceFiles":{"type":"integer","minimum":0}}},"PlanLibraryListResponse":{"type":"object","required":["ok","items","count","total","limit","offset","ts"],"properties":{"ok":{"type":"boolean","enum":[true]},"items":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryItem"}},"count":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"limit":{"type":"integer","minimum":1,"maximum":500},"offset":{"type":"integer","minimum":0},"orgId":{"type":"string"},"ts":{"type":"string","format":"date-time"}}},"WebReportOpenEnrollment":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"string"},"end":{"type":"string"}}},"WebReportRepublishEbcRequest":{"type":"object","additionalProperties":false,"required":["linkId"],"properties":{"linkId":{"type":"string","minLength":1},"title":{"type":"string","maxLength":200},"palette":{"type":"object","additionalProperties":true},"lang":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"openEnrollment":{"$ref":"#/components/schemas/WebReportOpenEnrollment"},"logoUrl":{"type":"string"},"censusSnapshots":{"type":"object","additionalProperties":true},"packet":{"type":"object","additionalProperties":true}}},"WebReportRepublishEbcResponse":{"type":"object","additionalProperties":false,"required":["ok","shortCode","shareUrl","kind"],"properties":{"ok":{"type":"boolean","enum":[true]},"shortCode":{"type":"string"},"shareUrl":{"type":"string"},"kind":{"type":"string","enum":["ebc"]},"expiresAt":{"type":"string","format":"date-time","nullable":true}}},"WebReportPreviewEbcOptions":{"type":"object","additionalProperties":false,"properties":{"packet":{"type":"object","additionalProperties":true},"title":{"type":"string","maxLength":200},"palette":{"type":"object","additionalProperties":true},"censusSnapshots":{"type":"object","additionalProperties":true},"lang":{"type":"string"}}},"WebReportPreviewEbcRequest":{"type":"object","additionalProperties":false,"properties":{"options":{"$ref":"#/components/schemas/WebReportPreviewEbcOptions"},"reportData":{"type":"object","properties":{"proposalStrategy":{"$ref":"#/components/schemas/ProposalStrategy"}},"additionalProperties":true}},"description":"Preview input. The EBC packet must be supplied as options.packet or reportData.employeeComm."},"WebReportSignatureRequirementRequest":{"type":"object","additionalProperties":false,"required":["requireSignature"],"properties":{"requireSignature":{"type":"boolean"}}},"WebReportSignatureRequirementResponse":{"type":"object","additionalProperties":false,"required":["ok","requireSignature","message"],"properties":{"ok":{"type":"boolean","enum":[true]},"requireSignature":{"type":"boolean"},"message":{"type":"string"}}},"WebReportSignRequest":{"type":"object","additionalProperties":false,"required":["signatureImage","signerName"],"properties":{"signatureImage":{"type":"string","minLength":1},"signerName":{"type":"string","minLength":1},"signerEmail":{"type":"string","format":"email"},"signerCompany":{"type":"string"},"signerTitle":{"type":"string"},"signatureType":{"type":"string"}}},"WebReportSignResponse":{"type":"object","additionalProperties":false,"required":["ok","message"],"properties":{"ok":{"type":"boolean","enum":[true]},"message":{"type":"string"},"alreadySigned":{"type":"boolean"}}},"WebReportCaseSummary":{"type":"object","additionalProperties":false,"required":["reportId","shareUrl","kind","isLive","viewCount","watermarkEnabled","sectionOrder","columnAssignments","contributionModelingEnabled"],"properties":{"reportId":{"type":"string"},"shareUrl":{"type":"string"},"reportTitle":{"type":"string","nullable":true},"tab":{"type":"string","nullable":true},"kind":{"type":"string"},"isLive":{"type":"boolean"},"viewCount":{"type":"integer","minimum":0},"watermarkEnabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time","nullable":true},"expiresAt":{"type":"string","format":"date-time","nullable":true},"lastViewedAt":{"type":"string","format":"date-time","nullable":true},"lastRefreshedAt":{"type":"string","format":"date-time","nullable":true},"sectionOrder":{"type":"array","items":{"type":"string"}},"columnAssignments":{"type":"object","additionalProperties":true},"sectionOrderByType":{"type":"object","additionalProperties":true,"nullable":true},"columnAssignmentsByType":{"type":"object","additionalProperties":true,"nullable":true},"contributionModelingEnabled":{"type":"boolean"}}},"WebReportsForCaseResponse":{"type":"object","additionalProperties":false,"required":["ok","reports","count","hasExisting"],"properties":{"ok":{"type":"boolean","enum":[true]},"reports":{"type":"array","items":{"$ref":"#/components/schemas/WebReportCaseSummary"}},"count":{"type":"integer","minimum":0},"hasExisting":{"type":"boolean"}}},"WebReportDeviceBreakdown":{"type":"object","additionalProperties":false,"required":["mobile","desktop","tablet"],"properties":{"mobile":{"type":"integer","minimum":0},"desktop":{"type":"integer","minimum":0},"tablet":{"type":"integer","minimum":0}}},"WebReportBrowserBreakdown":{"type":"object","additionalProperties":false,"required":["chrome","firefox","safari","edge"],"properties":{"chrome":{"type":"integer","minimum":0},"firefox":{"type":"integer","minimum":0},"safari":{"type":"integer","minimum":0},"edge":{"type":"integer","minimum":0}}},"WebReportViewTrends":{"type":"object","additionalProperties":false,"required":["last7Days","last30Days"],"properties":{"last7Days":{"type":"integer","minimum":0},"last30Days":{"type":"integer","minimum":0}}},"WebReportDashboardStats":{"type":"object","additionalProperties":false,"properties":{"totalLinks":{"type":"integer","minimum":0},"liveLinks":{"type":"integer","minimum":0},"expiredLinks":{"type":"integer","minimum":0},"expiringSoon":{"type":"integer","minimum":0},"activeLinks":{"type":"integer","minimum":0},"totalViews":{"type":"integer","minimum":0}}},"WebReportDashboardAnalytics":{"type":"object","additionalProperties":false,"required":["uniqueVisitors","deviceBreakdown","browserBreakdown","viewTrends","firstView","lastView"],"properties":{"uniqueVisitors":{"type":"integer","minimum":0},"deviceBreakdown":{"$ref":"#/components/schemas/WebReportDeviceBreakdown"},"browserBreakdown":{"$ref":"#/components/schemas/WebReportBrowserBreakdown"},"viewTrends":{"$ref":"#/components/schemas/WebReportViewTrends"},"firstView":{"type":"string","format":"date-time","nullable":true},"lastView":{"type":"string","format":"date-time","nullable":true}}},"WebReportDashboardStatsResponse":{"type":"object","additionalProperties":false,"required":["ok","stats"],"properties":{"ok":{"type":"boolean","enum":[true]},"stats":{"$ref":"#/components/schemas/WebReportDashboardStats"},"analytics":{"$ref":"#/components/schemas/WebReportDashboardAnalytics"}}},"WebReportTopSection":{"type":"object","additionalProperties":false,"required":["name","count"],"properties":{"name":{"type":"string"},"count":{"type":"integer","minimum":0}}},"WebReportDashboardEngagement":{"type":"object","additionalProperties":false,"required":["avgTimeSeconds","avgScrollDepth","modelerOpens","pdfDownloads","topSections"],"properties":{"avgTimeSeconds":{"type":"integer","minimum":0},"avgScrollDepth":{"type":"integer","minimum":0},"modelerOpens":{"type":"integer","minimum":0},"pdfDownloads":{"type":"integer","minimum":0},"topSections":{"type":"array","items":{"$ref":"#/components/schemas/WebReportTopSection"}}}},"WebReportDashboardItemAnalytics":{"type":"object","additionalProperties":false,"required":["uniqueVisitors","viewTrends","deviceBreakdown","firstView","lastView"],"properties":{"uniqueVisitors":{"type":"integer","minimum":0},"viewTrends":{"$ref":"#/components/schemas/WebReportViewTrends"},"deviceBreakdown":{"$ref":"#/components/schemas/WebReportDeviceBreakdown"},"firstView":{"type":"string","format":"date-time","nullable":true},"lastView":{"type":"string","format":"date-time","nullable":true},"engagement":{"$ref":"#/components/schemas/WebReportDashboardEngagement"}}},"WebReportDashboardItem":{"type":"object","additionalProperties":false,"required":["report_id","share_url","view_count","is_live","watermark_enabled","notify_on_view","contribution_modeling_enabled","engagement_tracking_enabled","share_options","analytics"],"properties":{"report_id":{"type":"string"},"case_id":{"type":"string","nullable":true},"tab":{"type":"string","nullable":true},"share_url":{"type":"string"},"report_title":{"type":"string","nullable":true},"view_count":{"type":"integer","minimum":0},"last_viewed_at":{"type":"string","format":"date-time","nullable":true},"is_live":{"type":"boolean"},"created_at":{"type":"string","format":"date-time","nullable":true},"expires_at":{"type":"string","format":"date-time","nullable":true},"watermark_enabled":{"type":"boolean"},"notify_on_view":{"type":"boolean"},"contribution_modeling_enabled":{"type":"boolean"},"engagement_tracking_enabled":{"type":"boolean"},"share_options":{"type":"object","additionalProperties":true},"analytics":{"$ref":"#/components/schemas/WebReportDashboardItemAnalytics"}}},"WebReportDashboardListResponse":{"type":"object","additionalProperties":false,"required":["ok","reports","total"],"properties":{"ok":{"type":"boolean","enum":[true]},"reports":{"type":"array","items":{"$ref":"#/components/schemas/WebReportDashboardItem"}},"total":{"type":"integer","minimum":0},"filter":{"type":"string","enum":["all","active","expired","live","expiring-soon"]},"sortBy":{"type":"string","enum":["created","expires","views","title"]},"sortOrder":{"type":"string","enum":["asc","desc"]}}},"WebReportBulkDeleteRequest":{"type":"object","additionalProperties":false,"required":["reportIds"],"properties":{"reportIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string"}}}},"WebReportBulkDeleteResponse":{"type":"object","additionalProperties":false,"required":["ok","deleted","requested"],"properties":{"ok":{"type":"boolean","enum":[true]},"deleted":{"type":"integer","minimum":0},"requested":{"type":"integer","minimum":1}}},"WebReportBulkExtendRequest":{"type":"object","additionalProperties":false,"required":["reportIds","extendDays"],"properties":{"reportIds":{"type":"array","minItems":1,"maxItems":50,"items":{"type":"string"}},"extendDays":{"type":"integer","minimum":1,"maximum":365}}},"WebReportBulkExtendResponse":{"type":"object","additionalProperties":false,"required":["ok","updated","requested","extendDays"],"properties":{"ok":{"type":"boolean","enum":[true]},"updated":{"type":"integer","minimum":0},"requested":{"type":"integer","minimum":1},"extendDays":{"type":"integer","minimum":1,"maximum":365}}},"WebReportMobileMigrationRequest":{"type":"object","additionalProperties":false,"properties":{"liveOnly":{"type":"boolean","default":false},"dryRun":{"type":"boolean","default":false},"force":{"type":"boolean","default":false}}},"WebReportMobileMigrationError":{"type":"object","additionalProperties":false,"required":["reportId","error"],"properties":{"reportId":{"type":"string"},"error":{"type":"string"}}},"WebReportMobileMigrationResponse":{"type":"object","additionalProperties":false,"required":["ok","dryRun","force","total","migrated","updated","alreadyHasMobile","failed"],"properties":{"ok":{"type":"boolean","enum":[true]},"dryRun":{"type":"boolean"},"force":{"type":"boolean"},"total":{"type":"integer","minimum":0},"migrated":{"type":"integer","minimum":0},"updated":{"type":"integer","minimum":0},"alreadyHasMobile":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"errors":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/WebReportMobileMigrationError"}}}},"WebReportSingleMobileMigrationRequest":{"type":"object","additionalProperties":false,"properties":{"force":{"type":"boolean","default":false}}},"WebReportSingleMobileMigrationResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","migrated","alreadyHasMobile"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"migrated":{"type":"boolean"},"updated":{"type":"boolean"},"alreadyHasMobile":{"type":"boolean"}}},"WebReportRegenerateRequest":{"type":"object","additionalProperties":false,"properties":{"createBackup":{"type":"boolean","default":true}}},"WebReportRegenerateResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","benefitTypes","backupTimestamp","message"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"benefitTypes":{"type":"array","items":{"type":"string"}},"backupTimestamp":{"type":"string","nullable":true},"message":{"type":"string"}}},"WebReportEngagementRequest":{"type":"object","additionalProperties":false,"required":["sessionId"],"properties":{"sessionId":{"type":"string","minLength":1},"timeOnPageSeconds":{"type":"integer","minimum":0},"scrollDepthPercent":{"type":"number","minimum":0,"maximum":100},"sectionsViewed":{"type":"array","items":{"type":"string"}},"modelerOpened":{"type":"boolean"},"modelerScenariosViewed":{"type":"integer","minimum":0},"pdfDownloaded":{"type":"boolean"},"tabsSwitched":{"type":"integer","minimum":0},"isReturnVisit":{"type":"boolean"},"previousVisits":{"type":"integer","minimum":0},"referrerSource":{"type":"string","nullable":true},"utmSource":{"type":"string","nullable":true},"utmMedium":{"type":"string","nullable":true},"utmCampaign":{"type":"string","nullable":true},"clickCount":{"type":"integer","minimum":0},"clicks":{"type":"array","items":{"type":"object","additionalProperties":true}},"printAttempted":{"type":"boolean"},"copyEvents":{"type":"integer","minimum":0},"idleTimeSeconds":{"type":"integer","minimum":0},"focusTimeSeconds":{"type":"integer","minimum":0},"isBounce":{"type":"boolean"},"topHoveredPlans":{"type":"array","items":{"type":"object","additionalProperties":true}},"linkClicks":{"type":"array","items":{"type":"object","additionalProperties":true}},"firstScrollMs":{"type":"integer","minimum":0,"nullable":true},"firstClickMs":{"type":"integer","minimum":0,"nullable":true},"exitIntent":{"type":"boolean"},"orientation":{"type":"string","nullable":true},"costSectionTimeSeconds":{"type":"integer","minimum":0},"contributionScenarios":{"type":"array","items":{"type":"object","additionalProperties":true}},"tierFocus":{"type":"string","nullable":true},"costClicks":{"type":"integer","minimum":0},"copiedTextSamples":{"type":"array","items":{"type":"string"}},"screenshotAttempted":{"type":"boolean"},"expandedSections":{"type":"array","items":{"type":"string"}},"benefitDetailsViewed":{"type":"array","items":{"type":"object","additionalProperties":true}},"visitorEmail":{"type":"string","format":"email","nullable":true},"exitSection":{"type":"string","nullable":true},"exitScrollPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"lastInteractionSection":{"type":"string","nullable":true},"timeToExitSeconds":{"type":"integer","minimum":0,"nullable":true},"exitType":{"type":"string","nullable":true},"modelerActiveTimeSeconds":{"type":"integer","minimum":0},"modelerFirstInteractionMs":{"type":"integer","minimum":0,"nullable":true},"modelerTabSwitches":{"type":"integer","minimum":0},"modelerTabsVisited":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}}},"WebReportEngagementAcceptedResponse":{"type":"object","additionalProperties":false,"required":["ok"],"properties":{"ok":{"type":"boolean","enum":[true]},"message":{"type":"string","enum":["accepted"]}}},"WebReportSectionMetric":{"type":"object","additionalProperties":false,"required":["sectionId","viewCount"],"properties":{"sectionId":{"type":"string"},"viewCount":{"type":"integer","minimum":0}}},"WebReportReferrerMetric":{"type":"object","additionalProperties":false,"required":["source","count"],"properties":{"source":{"type":"string"},"count":{"type":"integer","minimum":0}}},"WebReportUtmCampaignMetric":{"type":"object","additionalProperties":false,"required":["source","count"],"properties":{"source":{"type":"string"},"medium":{"type":"string","nullable":true},"campaign":{"type":"string","nullable":true},"count":{"type":"integer","minimum":0}}},"WebReportEngagementAnalytics":{"type":"object","additionalProperties":false,"required":["totalViews","uniqueSessions","avgTimeSeconds","avgScrollDepth","modelerUsageCount","pdfDownloadCount","lastViewedAt","topSections"],"properties":{"totalViews":{"type":"integer","minimum":0},"uniqueSessions":{"type":"integer","minimum":0},"avgTimeSeconds":{"type":"number","minimum":0},"avgScrollDepth":{"type":"number","minimum":0},"modelerUsageCount":{"type":"integer","minimum":0},"pdfDownloadCount":{"type":"integer","minimum":0},"lastViewedAt":{"type":"string","format":"date-time","nullable":true},"topSections":{"type":"array","items":{"$ref":"#/components/schemas/WebReportSectionMetric"}},"bounceRate":{"type":"number","minimum":0},"returnVisitorRate":{"type":"number","minimum":0},"avgClickCount":{"type":"number","minimum":0},"printCount":{"type":"integer","minimum":0},"copyCount":{"type":"integer","minimum":0},"avgIdleSeconds":{"type":"integer","minimum":0},"avgFocusSeconds":{"type":"integer","minimum":0},"avgFirstScrollMs":{"type":"integer","minimum":0},"avgFirstClickMs":{"type":"integer","minimum":0},"exitIntentCount":{"type":"integer","minimum":0},"topReferrers":{"type":"array","items":{"$ref":"#/components/schemas/WebReportReferrerMetric"}},"utmCampaigns":{"type":"array","items":{"$ref":"#/components/schemas/WebReportUtmCampaignMetric"}}}},"WebReportEngagementAnalyticsResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","engagement"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"engagement":{"$ref":"#/components/schemas/WebReportEngagementAnalytics","nullable":true},"message":{"type":"string"}}},"WebReportEngagementTimelineEntry":{"type":"object","additionalProperties":false,"required":["sessionId","timeOnPage","scrollDepth","modelerOpened","pdfDownloaded","tabsSwitched","startedAt","lastActivity","location"],"properties":{"sessionId":{"type":"string"},"timeOnPage":{"type":"integer","minimum":0},"scrollDepth":{"type":"number","minimum":0},"modelerOpened":{"type":"boolean"},"pdfDownloaded":{"type":"boolean"},"tabsSwitched":{"type":"integer","minimum":0},"startedAt":{"type":"string","format":"date-time","nullable":true},"lastActivity":{"type":"string","format":"date-time","nullable":true},"device":{"type":"string","nullable":true},"browser":{"type":"string","nullable":true},"location":{"type":"string","nullable":true}}},"WebReportEngagementTimelineResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","timeline"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"timeline":{"type":"array","items":{"$ref":"#/components/schemas/WebReportEngagementTimelineEntry"}}}},"WebReportNotificationSettingsResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","notify_realtime","notify_email","min_interval_minutes"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"notify_realtime":{"type":"boolean"},"notify_email":{"type":"boolean"},"min_interval_minutes":{"type":"integer","minimum":0,"maximum":1440},"last_notified_at":{"type":"string","format":"date-time","nullable":true},"message":{"type":"string"}}},"WebReportNotificationSettingsRequest":{"type":"object","additionalProperties":false,"properties":{"notifyRealtime":{"type":"boolean"},"notifyEmail":{"type":"boolean"},"minIntervalMinutes":{"type":"integer","minimum":0,"maximum":1440}}},"WebReportNotificationUpdate":{"type":"object","additionalProperties":false,"required":["notifyRealtime","notifyEmail","minIntervalMinutes"],"properties":{"notifyRealtime":{"type":"boolean"},"notifyEmail":{"type":"boolean"},"minIntervalMinutes":{"type":"integer","minimum":0,"maximum":1440}}},"WebReportNotificationUpdateResponse":{"type":"object","additionalProperties":false,"required":["ok","reportId","notifications"],"properties":{"ok":{"type":"boolean","enum":[true]},"reportId":{"type":"string"},"notifications":{"$ref":"#/components/schemas/WebReportNotificationUpdate"}}},"ExternalOAuthScopeDefinition":{"type":"object","additionalProperties":false,"required":["id","name","description"],"properties":{"id":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]},"name":{"type":"string"},"description":{"type":"string"}}},"ExternalOAuthScopesResponse":{"type":"object","additionalProperties":false,"required":["success","scopes"],"properties":{"success":{"type":"boolean","enum":[true]},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/ExternalOAuthScopeDefinition"}}}},"ExternalOAuthApp":{"type":"object","additionalProperties":false,"required":["id","app_name","app_slug","client_id","redirect_uris","allowed_scopes","rate_limit_per_minute","rate_limit_per_day","app_type","is_confidential","is_active","is_verified","created_at","updated_at"],"properties":{"id":{"type":"string"},"app_name":{"type":"string"},"app_slug":{"type":"string"},"description":{"type":"string","nullable":true},"logo_url":{"type":"string","nullable":true,"format":"uri"},"homepage_url":{"type":"string","nullable":true,"format":"uri"},"privacy_policy_url":{"type":"string","nullable":true,"format":"uri"},"terms_of_service_url":{"type":"string","nullable":true,"format":"uri"},"client_id":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string","format":"uri"}},"allowed_scopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"rate_limit_per_minute":{"type":"integer","minimum":1},"rate_limit_per_day":{"type":"integer","minimum":1},"app_type":{"type":"string"},"is_confidential":{"type":"boolean"},"is_active":{"type":"boolean"},"is_verified":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"ExternalOAuthAppsResponse":{"type":"object","additionalProperties":false,"required":["success","apps"],"properties":{"success":{"type":"boolean","enum":[true]},"apps":{"type":"array","items":{"$ref":"#/components/schemas/ExternalOAuthApp"}}}},"ExternalOAuthAppResponse":{"type":"object","additionalProperties":false,"required":["success","app"],"properties":{"success":{"type":"boolean","enum":[true]},"app":{"$ref":"#/components/schemas/ExternalOAuthApp"}}},"ExternalOAuthAppCreateRequest":{"type":"object","additionalProperties":false,"required":["appName","redirectUris"],"properties":{"appName":{"type":"string","minLength":2},"description":{"type":"string"},"logoUrl":{"type":"string","format":"uri"},"homepageUrl":{"type":"string","format":"uri"},"privacyPolicyUrl":{"type":"string","format":"uri"},"termsOfServiceUrl":{"type":"string","format":"uri"},"redirectUris":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1},"allowedScopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"rateLimitPerMinute":{"type":"integer","minimum":1,"default":60},"rateLimitPerDay":{"type":"integer","minimum":1,"default":10000},"appType":{"type":"string","default":"third_party"},"isConfidential":{"type":"boolean","default":true}}},"ExternalOAuthAppCreated":{"type":"object","additionalProperties":false,"required":["id","app_name","app_slug","client_id","created_at","clientSecret"],"properties":{"id":{"type":"string"},"app_name":{"type":"string"},"app_slug":{"type":"string"},"client_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"clientSecret":{"type":"string"}}},"ExternalOAuthAppCreateResponse":{"type":"object","additionalProperties":false,"required":["success","app","warning"],"properties":{"success":{"type":"boolean","enum":[true]},"app":{"$ref":"#/components/schemas/ExternalOAuthAppCreated"},"warning":{"type":"string"}}},"ExternalOAuthAppUpdateRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"appName":{"type":"string","minLength":2},"description":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true,"format":"uri"},"homepageUrl":{"type":"string","nullable":true,"format":"uri"},"privacyPolicyUrl":{"type":"string","nullable":true,"format":"uri"},"termsOfServiceUrl":{"type":"string","nullable":true,"format":"uri"},"redirectUris":{"type":"array","items":{"type":"string","format":"uri"}},"allowedScopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"rateLimitPerMinute":{"type":"integer","minimum":1},"rateLimitPerDay":{"type":"integer","minimum":1},"isActive":{"type":"boolean"}}},"ExternalOAuthAppIdentity":{"type":"object","additionalProperties":false,"required":["id","app_name"],"properties":{"id":{"type":"string"},"app_name":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"ExternalOAuthAppUpdateResponse":{"type":"object","additionalProperties":false,"required":["success","app"],"properties":{"success":{"type":"boolean","enum":[true]},"app":{"$ref":"#/components/schemas/ExternalOAuthAppIdentity"}}},"ExternalOAuthAppDeleteResponse":{"type":"object","additionalProperties":false,"required":["success","deleted"],"properties":{"success":{"type":"boolean","enum":[true]},"deleted":{"$ref":"#/components/schemas/ExternalOAuthAppIdentity"}}},"ExternalOAuthSecretRotationResponse":{"type":"object","additionalProperties":false,"required":["success","clientSecret","warning"],"properties":{"success":{"type":"boolean","enum":[true]},"clientSecret":{"type":"string"},"warning":{"type":"string"}}},"ExternalApiKey":{"type":"object","additionalProperties":false,"required":["id","key_prefix","name","scopes","rate_limit_per_minute","rate_limit_per_day","is_active","use_count","created_at"],"properties":{"id":{"type":"string"},"key_prefix":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"allowed_ips":{"type":"array","items":{"type":"string"},"nullable":true},"allowed_origins":{"type":"array","items":{"type":"string","format":"uri"},"nullable":true},"rate_limit_per_minute":{"type":"integer","minimum":1},"rate_limit_per_day":{"type":"integer","minimum":1},"expires_at":{"type":"string","format":"date-time","nullable":true},"is_active":{"type":"boolean"},"last_used_at":{"type":"string","format":"date-time","nullable":true},"use_count":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"},"revoked_at":{"type":"string","format":"date-time","nullable":true}}},"ExternalApiKeysResponse":{"type":"object","additionalProperties":false,"required":["success","apiKeys"],"properties":{"success":{"type":"boolean","enum":[true]},"apiKeys":{"type":"array","items":{"$ref":"#/components/schemas/ExternalApiKey"}}}},"ExternalApiKeyCreateRequest":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":2},"description":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"allowedIps":{"type":"array","items":{"type":"string"}},"allowedOrigins":{"type":"array","items":{"type":"string","format":"uri"}},"rateLimitPerMinute":{"type":"integer","minimum":1,"default":60},"rateLimitPerDay":{"type":"integer","minimum":1,"default":10000},"expiresAt":{"type":"string","format":"date-time"}}},"ExternalApiKeyCreated":{"type":"object","additionalProperties":false,"required":["id","key_prefix","name","created_at","key"],"properties":{"id":{"type":"string"},"key_prefix":{"type":"string"},"name":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"key":{"type":"string"}}},"ExternalApiKeyCreateResponse":{"type":"object","additionalProperties":false,"required":["success","apiKey","warning"],"properties":{"success":{"type":"boolean","enum":[true]},"apiKey":{"$ref":"#/components/schemas/ExternalApiKeyCreated"},"warning":{"type":"string"}}},"ExternalApiKeyUpdateRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","minLength":2},"description":{"type":"string","nullable":true},"scopes":{"type":"array","items":{"type":"string","enum":["read:cases","write:cases","read:plans","write:plans","read:census","write:census","read:reports","read:organizations","admin:organizations","read:users","offline_access"]}},"allowedIps":{"type":"array","items":{"type":"string"},"nullable":true},"allowedOrigins":{"type":"array","items":{"type":"string","format":"uri"},"nullable":true},"rateLimitPerMinute":{"type":"integer","minimum":1},"rateLimitPerDay":{"type":"integer","minimum":1},"expiresAt":{"type":"string","format":"date-time","nullable":true},"isActive":{"type":"boolean"}}},"ExternalApiKeyIdentity":{"type":"object","additionalProperties":false,"required":["id","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"}}},"ExternalApiKeyUpdateResponse":{"type":"object","additionalProperties":false,"required":["success","apiKey"],"properties":{"success":{"type":"boolean","enum":[true]},"apiKey":{"$ref":"#/components/schemas/ExternalApiKeyIdentity"}}},"ExternalApiKeyRevokeRequest":{"type":"object","additionalProperties":false,"properties":{"reason":{"type":"string"}}},"ExternalApiKeyRevokeResponse":{"type":"object","additionalProperties":false,"required":["success","revoked"],"properties":{"success":{"type":"boolean","enum":[true]},"revoked":{"$ref":"#/components/schemas/ExternalApiKeyIdentity"}}},"ExternalApiKeyDailyUsage":{"type":"object","additionalProperties":false,"required":["date","total_requests","successful","errors","avg_response_time_ms"],"properties":{"date":{"type":"string","format":"date"},"total_requests":{"type":"string","pattern":"^\\d+$"},"successful":{"type":"string","pattern":"^\\d+$"},"errors":{"type":"string","pattern":"^\\d+$"},"avg_response_time_ms":{"type":"integer","minimum":0,"nullable":true}}},"ExternalApiKeyEndpointUsage":{"type":"object","additionalProperties":false,"required":["endpoint","method","count"],"properties":{"endpoint":{"type":"string"},"method":{"type":"string"},"count":{"type":"string","pattern":"^\\d+$"}}},"ExternalApiKeyUsageResponse":{"type":"object","additionalProperties":false,"required":["success","usage"],"properties":{"success":{"type":"boolean","enum":[true]},"usage":{"type":"object","additionalProperties":false,"required":["daily","topEndpoints"],"properties":{"daily":{"type":"array","items":{"$ref":"#/components/schemas/ExternalApiKeyDailyUsage"}},"topEndpoints":{"type":"array","items":{"$ref":"#/components/schemas/ExternalApiKeyEndpointUsage"}}}}}},"ExternalOAuthConsentApplication":{"type":"object","additionalProperties":false,"required":["name","logoUrl"],"properties":{"name":{"type":"string"},"logoUrl":{"type":"string","nullable":true,"format":"uri"}}},"ExternalOAuthConsentDetails":{"type":"object","additionalProperties":false,"required":["token","application","scopes"],"properties":{"token":{"type":"string"},"application":{"$ref":"#/components/schemas/ExternalOAuthConsentApplication"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/ExternalOAuthScopeDefinition"}}}},"ExternalOAuthConsentResponse":{"type":"object","additionalProperties":false,"required":["ok","consent"],"properties":{"ok":{"type":"boolean","enum":[true]},"consent":{"$ref":"#/components/schemas/ExternalOAuthConsentDetails"}}},"ExternalOAuthConsentDecisionResponse":{"type":"object","additionalProperties":false,"required":["ok","approved","redirectUrl"],"properties":{"ok":{"type":"boolean","enum":[true]},"approved":{"type":"boolean"},"redirectUrl":{"type":"string","format":"uri"}}},"ExternalOAuthTokenRequest":{"type":"object","additionalProperties":false,"required":["grant_type"],"properties":{"grant_type":{"type":"string","enum":["authorization_code","refresh_token"]},"code":{"type":"string"},"redirect_uri":{"type":"string","format":"uri"},"client_id":{"type":"string"},"client_secret":{"type":"string"},"refresh_token":{"type":"string"},"code_verifier":{"type":"string"}}},"ExternalOAuthTokenResponse":{"type":"object","additionalProperties":false,"required":["access_token","token_type","expires_in","scope"],"properties":{"access_token":{"type":"string"},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"integer","minimum":1},"scope":{"type":"string"},"refresh_token":{"type":"string"}}},"ExternalOAuthErrorResponse":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"},"error_description":{"type":"string"}}},"ExternalOAuthRevokeRequest":{"type":"object","additionalProperties":false,"required":["token"],"properties":{"token":{"type":"string"},"token_type_hint":{"type":"string","enum":["access_token","refresh_token"]}}},"ExternalOAuthRevokeResponse":{"type":"object","additionalProperties":false,"required":["success"],"properties":{"success":{"type":"boolean","enum":[true]}}},"SbcLink":{"type":"object","additionalProperties":false,"required":["id","s3Key","shortCode","shortUrl","createdAt","expiresAt","viewCount","lastViewedAt","deleted","deletedAt","customSlug","requireSignature","signedAt","signedByName","signedByEmail","urlPrefix","kind"],"properties":{"id":{"type":"string"},"s3Key":{"type":"string"},"shortCode":{"type":"string"},"shortUrl":{"type":"string","format":"uri"},"originalName":{"type":"string","nullable":true},"caseId":{"type":"string","nullable":true},"planId":{"type":"string","nullable":true},"userId":{"type":"string","nullable":true},"orgId":{"type":"string","nullable":true},"createdAt":{"type":"integer","format":"int64","minimum":0,"nullable":true,"description":"Unix timestamp in milliseconds."},"expiresAt":{"type":"integer","format":"int64","minimum":0,"nullable":true,"description":"Unix timestamp in milliseconds."},"viewCount":{"type":"integer","minimum":0},"lastViewedAt":{"type":"integer","format":"int64","minimum":0,"nullable":true,"description":"Unix timestamp in milliseconds."},"deleted":{"type":"boolean"},"deletedAt":{"type":"integer","format":"int64","minimum":0,"nullable":true,"description":"Unix timestamp in milliseconds."},"customSlug":{"type":"string","nullable":true},"requireSignature":{"type":"boolean"},"signedAt":{"type":"integer","format":"int64","minimum":0,"nullable":true,"description":"Unix timestamp in milliseconds."},"signedByName":{"type":"string","nullable":true},"signedByEmail":{"type":"string","nullable":true,"format":"email"},"urlPrefix":{"type":"string","enum":["sbc","share","portal","guide"]},"kind":{"type":"string","enum":["sbc","sharefile","portal","guide"]}}},"SbcLinkCreateRequest":{"type":"object","additionalProperties":false,"required":["s3Key"],"properties":{"s3Key":{"type":"string","minLength":1},"ttlSeconds":{"type":"integer","minimum":1,"description":"Requested lifetime in seconds. The service clamps the effective lifetime to 5 minutes through 180 days."},"caseId":{"type":"string"},"planId":{"type":"string"},"originalName":{"type":"string"},"customSlug":{"type":"string","minLength":3,"maxLength":64},"requireSignature":{"type":"boolean","default":false},"urlPrefix":{"type":"string","enum":["sbc","share"],"default":"sbc"},"kind":{"type":"string","enum":["sbc","sharefile","portal","guide"],"default":"sbc"}}},"SbcLinkCreateResponse":{"type":"object","additionalProperties":false,"required":["success","code","shortUrl","expiresAt","linkId","tracked","customSlug","urlPrefix"],"properties":{"success":{"type":"boolean","enum":[true]},"code":{"type":"string"},"shortUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"integer","format":"int64","minimum":0,"description":"Unix timestamp in milliseconds."},"linkId":{"type":"string"},"tracked":{"type":"boolean","enum":[true]},"customSlug":{"type":"string","nullable":true},"urlPrefix":{"type":"string","enum":["sbc","share"]}}},"SbcLinkListResponse":{"type":"object","additionalProperties":false,"required":["success","links"],"properties":{"success":{"type":"boolean","enum":[true]},"links":{"type":"array","items":{"$ref":"#/components/schemas/SbcLink"}},"count":{"type":"integer","minimum":0},"message":{"type":"string"}}},"SbcSignatureLinkListResponse":{"type":"object","additionalProperties":false,"required":["success","links","count"],"properties":{"success":{"type":"boolean","enum":[true]},"links":{"type":"array","items":{"$ref":"#/components/schemas/SbcLink"}},"count":{"type":"integer","minimum":0}}},"SbcLinkResponse":{"type":"object","additionalProperties":false,"required":["success","link"],"properties":{"success":{"type":"boolean","enum":[true]},"link":{"$ref":"#/components/schemas/SbcLink"}}},"SbcLinkUpdateRequest":{"type":"object","additionalProperties":false,"minProperties":1,"properties":{"expiresAt":{"type":"string","format":"date-time"},"extendDays":{"type":"integer","minimum":1,"maximum":180}}},"SbcLinkDeleteResponse":{"type":"object","additionalProperties":false,"required":["success","message"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"}}},"SbcLinkView":{"type":"object","additionalProperties":false,"required":["viewedAt","referrer","deviceType","browser","os"],"properties":{"viewedAt":{"type":"string","format":"date-time","nullable":true},"referrer":{"type":"string","nullable":true,"format":"uri"},"deviceType":{"type":"string","nullable":true},"browser":{"type":"string","nullable":true},"os":{"type":"string","nullable":true}}},"SbcLinkViewsByDay":{"type":"object","additionalProperties":false,"required":["date","count"],"properties":{"date":{"type":"string","format":"date"},"count":{"type":"integer","minimum":0}}},"SbcLinkDeviceCount":{"type":"object","additionalProperties":false,"required":["device","count"],"properties":{"device":{"type":"string"},"count":{"type":"integer","minimum":0}}},"SbcLinkBrowserCount":{"type":"object","additionalProperties":false,"required":["browser","count"],"properties":{"browser":{"type":"string"},"count":{"type":"integer","minimum":0}}},"SbcLinkOsCount":{"type":"object","additionalProperties":false,"required":["os","count"],"properties":{"os":{"type":"string"},"count":{"type":"integer","minimum":0}}},"SbcLinkAnalytics":{"type":"object","additionalProperties":false,"required":["views","viewsByDay","deviceBreakdown","browserBreakdown","osBreakdown"],"properties":{"link":{"$ref":"#/components/schemas/SbcLink"},"totalViews":{"type":"integer","minimum":0},"recentViews":{"type":"integer","minimum":0},"viewCount":{"type":"integer","minimum":0,"description":"Present on degraded analytics responses."},"views":{"type":"array","items":{"$ref":"#/components/schemas/SbcLinkView"}},"viewsByDay":{"type":"array","items":{"$ref":"#/components/schemas/SbcLinkViewsByDay"}},"deviceBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/SbcLinkDeviceCount"}},"browserBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/SbcLinkBrowserCount"}},"osBreakdown":{"type":"array","items":{"$ref":"#/components/schemas/SbcLinkOsCount"}}}},"SbcLinkAnalyticsResponse":{"type":"object","additionalProperties":false,"required":["success","analytics"],"properties":{"success":{"type":"boolean","enum":[true]},"analytics":{"$ref":"#/components/schemas/SbcLinkAnalytics","nullable":true}}},"OrganizationBranding":{"type":"object","description":"Resolved organization identity and optional custom branding.","additionalProperties":false,"properties":{"name":{"type":"string","nullable":true,"description":"Organization display name."},"logoUrl":{"type":"string","nullable":true,"description":"Organization logo URL."},"description":{"type":"string","nullable":true,"description":"Organization description."},"primaryColor":{"type":"string","nullable":true},"secondaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"headerText":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"emailSignature":{"type":"string","nullable":true},"reportWatermark":{"type":"string","nullable":true},"favicon":{"type":"string","nullable":true},"customCss":{"type":"string","nullable":true}}},"OrganizationBrandingUpdateRequest":{"type":"object","description":"Organization identity or custom branding fields to update.","additionalProperties":false,"minProperties":1,"properties":{"name":{"type":"string","nullable":true,"description":"Organization display name."},"logoUrl":{"type":"string","nullable":true,"description":"Organization logo URL."},"description":{"type":"string","nullable":true,"description":"Organization description."},"primaryColor":{"type":"string","nullable":true},"secondaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"headerText":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"emailSignature":{"type":"string","nullable":true},"reportWatermark":{"type":"string","nullable":true},"favicon":{"type":"string","nullable":true},"customCss":{"type":"string","nullable":true},"logo_url":{"type":"string","nullable":true,"description":"Legacy snake-case alias for logoUrl."}}},"OrganizationBrandingResponse":{"type":"object","additionalProperties":false,"required":["success","branding"],"properties":{"success":{"type":"boolean","enum":[true]},"branding":{"$ref":"#/components/schemas/OrganizationBranding"}}},"OrganizationSettings":{"type":"object","description":"Stored organization settings accepted by the update endpoint.","additionalProperties":false,"properties":{"defaultCaseVisibility":{"type":"string","description":"Default visibility assigned to newly created cases."},"defaultPlanVisibility":{"type":"string","description":"Default visibility assigned to newly created plans."},"requireApprovalForSharing":{"type":"boolean"},"allowGuestAccess":{"type":"boolean"},"maxCasesPerUser":{"type":"integer","nullable":true},"maxPlansPerUser":{"type":"integer","nullable":true},"enableAuditLogs":{"type":"boolean"},"retentionDays":{"type":"integer"},"customFields":{"type":"object","additionalProperties":true,"nullable":true},"notifications":{"type":"object","additionalProperties":true,"nullable":true},"integrations":{"type":"object","additionalProperties":true,"nullable":true}}},"OrganizationResolvedSettings":{"type":"object","description":"Organization settings with server defaults applied.","additionalProperties":false,"required":["defaultCaseVisibility","defaultPlanVisibility","requireApprovalForSharing","allowGuestAccess","maxCasesPerUser","maxPlansPerUser","enableAuditLogs","retentionDays"],"properties":{"defaultCaseVisibility":{"type":"string","description":"Default visibility assigned to newly created cases."},"defaultPlanVisibility":{"type":"string","description":"Default visibility assigned to newly created plans."},"requireApprovalForSharing":{"type":"boolean"},"allowGuestAccess":{"type":"boolean"},"maxCasesPerUser":{"type":"integer","nullable":true},"maxPlansPerUser":{"type":"integer","nullable":true},"enableAuditLogs":{"type":"boolean"},"retentionDays":{"type":"integer"},"customFields":{"type":"object","additionalProperties":true,"nullable":true},"notifications":{"type":"object","additionalProperties":true,"nullable":true},"integrations":{"type":"object","additionalProperties":true,"nullable":true}}},"OrganizationSettingsResponse":{"type":"object","additionalProperties":false,"required":["success","settings"],"properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/OrganizationSettings"}}},"OrganizationResolvedSettingsResponse":{"type":"object","additionalProperties":false,"required":["success","settings"],"properties":{"success":{"type":"boolean","enum":[true]},"settings":{"$ref":"#/components/schemas/OrganizationResolvedSettings"}}},"OrganizationInvitationRecord":{"type":"object","description":"Pending organization invitation returned by the persistence layer.","additionalProperties":false,"required":["external_id","org_id","email","token","expires_at"],"properties":{"id":{"type":"string"},"external_id":{"type":"string"},"org_id":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["viewer","editor","admin"],"nullable":true},"token":{"type":"string"},"created_by":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"accepted_at":{"type":"string","format":"date-time","nullable":true},"accepted_by":{"type":"string","nullable":true}}},"OrganizationInvitationResendResponse":{"type":"object","additionalProperties":false,"required":["ok","invitation","token","emailSent"],"properties":{"ok":{"type":"boolean","enum":[true]},"invitation":{"$ref":"#/components/schemas/OrganizationInvitationRecord"},"token":{"type":"string"},"emailSent":{"type":"boolean"},"emailMessageId":{"type":"string"},"emailError":{"type":"string"}}},"OrganizationBatchInvitationMember":{"type":"object","additionalProperties":false,"required":["email"],"properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["viewer","editor","admin"],"default":"viewer"}}},"OrganizationBatchInvitationRequest":{"type":"object","additionalProperties":false,"required":["members"],"properties":{"members":{"type":"array","minItems":1,"maxItems":50,"items":{"$ref":"#/components/schemas/OrganizationBatchInvitationMember"}}}},"OrganizationBatchInvitationResult":{"type":"object","additionalProperties":false,"required":["email","success"],"properties":{"email":{"type":"string"},"success":{"type":"boolean"},"method":{"type":"string","enum":["invitation"]},"emailSent":{"type":"boolean"},"token":{"type":"string","description":"Manual invitation token, returned only when invitation email delivery fails."},"error":{"type":"string"},"skipped":{"type":"boolean"}}},"OrganizationBatchInvitationSummary":{"type":"object","additionalProperties":false,"required":["total","successful","invited","skipped","failed"],"properties":{"total":{"type":"integer","minimum":1},"successful":{"type":"integer","minimum":0},"invited":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0}}},"OrganizationBatchInvitationResponse":{"type":"object","additionalProperties":false,"required":["success","summary","results"],"properties":{"success":{"type":"boolean","enum":[true]},"summary":{"$ref":"#/components/schemas/OrganizationBatchInvitationSummary"},"results":{"type":"array","items":{"$ref":"#/components/schemas/OrganizationBatchInvitationResult"}}}},"CaseReconciliationCorrection":{"type":"object","description":"A staged reconciliation correction.","additionalProperties":true,"properties":{"kind":{"type":"string","enum":["tier","plan","ghost","add"]},"lastName":{"type":"string"},"firstName":{"type":"string"},"from":{},"to":{},"tier":{},"premium":{"type":"number","nullable":true},"benefitType":{"type":"string","nullable":true},"confidence":{"type":"number","nullable":true},"designation":{"type":"string"},"stagedAt":{"type":"integer","format":"int64","description":"Unix timestamp in milliseconds."}}},"CaseReconciliationRestorePayload":{"type":"object","description":"Extensible reconciliation sidecar. Known v1 fields are documented while roster and census rows retain parser-specific data.","additionalProperties":true,"properties":{"v":{"type":"integer","enum":[1]},"entryId":{"type":"string"},"savedAt":{"type":"string","format":"date-time"},"roster":{"type":"array","items":{"type":"object","additionalProperties":true}},"census":{"type":"array","items":{"type":"object","additionalProperties":true}},"relinks":{"type":"array","items":{"type":"array","minItems":2,"maxItems":2,"items":{"type":"string"}}},"planMap":{"type":"object","additionalProperties":true},"corrections":{"type":"array","items":{"$ref":"#/components/schemas/CaseReconciliationCorrection"}},"invoiceFileName":{"type":"string"},"censusFileName":{"type":"string"}}},"PlanLinkInput":{"type":"object","additionalProperties":false,"required":["sourceId","targetId","linkType"],"properties":{"sourceId":{"type":"string","minLength":1},"targetId":{"type":"string","minLength":1},"linkType":{"type":"string","enum":["renewal","proposed","alternate"]}}},"PlanLink":{"type":"object","additionalProperties":false,"required":["id","sourceId","targetId","linkType","createdAt"],"properties":{"id":{"type":"string"},"sourceId":{"type":"string"},"targetId":{"type":"string"},"linkType":{"type":"string","enum":["renewal","proposed","alternate"]},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"}}},"PlanLinkBatchRequest":{"type":"object","additionalProperties":false,"required":["links"],"properties":{"links":{"type":"array","minItems":1,"maxItems":100,"items":{"$ref":"#/components/schemas/PlanLinkInput"}}}},"PlanLinkBatchResponse":{"type":"object","additionalProperties":false,"required":["success","message","links"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"},"links":{"type":"array","items":{"$ref":"#/components/schemas/PlanLink"}}}},"PlanLinksForPlan":{"type":"object","additionalProperties":false,"required":["outgoing","incoming","all"],"properties":{"outgoing":{"type":"array","items":{"$ref":"#/components/schemas/PlanLink"}},"incoming":{"type":"array","items":{"$ref":"#/components/schemas/PlanLink"}},"all":{"type":"array","items":{"$ref":"#/components/schemas/PlanLink"}}}},"PlanLinksForPlanResponse":{"type":"object","additionalProperties":false,"required":["success","planId","links"],"properties":{"success":{"type":"boolean","enum":[true]},"planId":{"type":"string"},"links":{"$ref":"#/components/schemas/PlanLinksForPlan"}}},"PlanLinkErrorResponse":{"type":"object","additionalProperties":false,"required":["success","error"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"object","additionalProperties":true}},"invalidLinks":{"type":"array","items":{"$ref":"#/components/schemas/PlanLinkInput"}}}},"ChatAction":{"type":"object","description":"Assistant action or legacy recommendation attached to a message.","additionalProperties":true,"properties":{"kind":{"type":"string"},"type":{"type":"string"},"label":{"type":"string"},"intentId":{"type":"string"},"planId":{"type":"string"},"params":{"type":"object","additionalProperties":true}}},"ChatCard":{"type":"object","description":"Structured card rendered with a chat message.","additionalProperties":true,"properties":{"kind":{"type":"string","maxLength":64}}},"ChatKeyMetric":{"type":"object","additionalProperties":false,"properties":{"label":{"type":"string","maxLength":160},"value":{"type":"string","maxLength":160},"tone":{"type":"string","maxLength":32},"citation":{}}},"ChatMessageInput":{"type":"object","description":"Message accepted for cloud persistence. It must contain visible text, a card, actions, or use the user role.","additionalProperties":false,"properties":{"role":{"type":"string","maxLength":32,"default":"assistant"},"content":{"type":"string","maxLength":16000},"summary":{"type":"string","maxLength":500},"details":{"type":"string","maxLength":16000},"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp in milliseconds."},"ordinal":{"type":"integer","minimum":0},"clientMid":{"type":"string","maxLength":160},"_mid":{"type":"string","maxLength":160},"card":{"$ref":"#/components/schemas/ChatCard"},"attachments":{"type":"array","items":{}},"citations":{"type":"array","items":{}},"actions":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/ChatAction"}},"recommendedActions":{"type":"array","maxItems":20,"deprecated":true,"description":"Legacy action envelope normalized into actions when persisted.","items":{"$ref":"#/components/schemas/ChatAction"}},"feedback":{"type":"string","maxLength":8},"intentId":{"type":"string","maxLength":120},"params":{"type":"object","additionalProperties":true},"keyMetrics":{"type":"array","maxItems":6,"items":{"$ref":"#/components/schemas/ChatKeyMetric"}},"groundingNote":{"type":"string","maxLength":1000},"evidence":{"type":"object","additionalProperties":true}}},"ChatMessage":{"type":"object","description":"Chronological chat message hydrated from cloud persistence.","additionalProperties":false,"required":["role","content","timestamp","ordinal"],"properties":{"role":{"type":"string"},"content":{"type":"string"},"summary":{"type":"string","maxLength":500},"details":{"type":"string","maxLength":16000},"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp in milliseconds."},"ordinal":{"type":"integer","minimum":0},"clientMid":{"type":"string","maxLength":160},"_mid":{"type":"string","maxLength":160},"card":{"$ref":"#/components/schemas/ChatCard"},"attachments":{"type":"array","items":{}},"citations":{"type":"array","items":{}},"actions":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/ChatAction"}},"recommendedActions":{"type":"array","maxItems":20,"deprecated":true,"description":"Legacy action envelope normalized into actions when persisted.","items":{"$ref":"#/components/schemas/ChatAction"}},"feedback":{"type":"string","maxLength":8},"intentId":{"type":"string","maxLength":120},"params":{"type":"object","additionalProperties":true},"keyMetrics":{"type":"array","maxItems":6,"items":{"$ref":"#/components/schemas/ChatKeyMetric"}},"groundingNote":{"type":"string","maxLength":1000},"evidence":{"type":"object","additionalProperties":true}}},"ChatMessagesRequest":{"type":"object","additionalProperties":false,"properties":{"caseId":{"type":"string","maxLength":128,"default":"default"},"message":{"$ref":"#/components/schemas/ChatMessageInput"},"messages":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/ChatMessageInput"}}},"anyOf":[{"required":["message"]},{"required":["messages"]}]},"ChatMessagesResponse":{"type":"object","additionalProperties":false,"required":["ok","caseId","messages","count"],"properties":{"ok":{"type":"boolean","enum":[true]},"caseId":{"type":"string"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}},"count":{"type":"integer","minimum":0}}},"ChatMessageInsertRecord":{"type":"object","additionalProperties":false,"required":["id","ordinal","created_at"],"properties":{"id":{"type":"string"},"ordinal":{"type":"integer","minimum":0},"created_at":{"type":"string","format":"date-time"}}},"ChatMessagesPostResponse":{"type":"object","additionalProperties":false,"required":["ok","caseId","inserted"],"properties":{"ok":{"type":"boolean","enum":[true]},"caseId":{"type":"string"},"inserted":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessageInsertRecord"}},"truncated":{"type":"array","description":"Ordinals whose text fields were truncated to persistence limits.","items":{"type":"integer","minimum":0}},"rotated":{"type":"integer","minimum":1,"description":"Number of oldest messages evicted to preserve the rolling cap."}}},"ChatClearMessagesRequest":{"type":"object","additionalProperties":false,"properties":{"caseId":{"type":"string","maxLength":128,"default":"default"}}},"ChatDeleteMessagesResponse":{"type":"object","additionalProperties":false,"required":["ok","deleted"],"properties":{"ok":{"type":"boolean","enum":[true]},"deleted":{"type":"integer","minimum":0}}},"ChatErrorResponse":{"type":"object","additionalProperties":false,"required":["ok","error"],"properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"string"}}},"SignatureSigner":{"type":"object","additionalProperties":false,"required":["fullName","email"],"properties":{"fullName":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true}}},"SignatureImageInput":{"type":"object","additionalProperties":false,"required":["type","image"],"properties":{"type":{"type":"string","enum":["typed","draw"]},"image":{"type":"string","description":"PNG signature image as a data URL or base64 string."},"text":{"type":"string","nullable":true,"description":"Typed signature text; persisted only for typed signatures."},"font":{"type":"string","nullable":true,"description":"Optional client-side font label."}}},"SignatureSubmissionMeta":{"type":"object","additionalProperties":false,"properties":{"userAgent":{"type":"string"},"language":{"type":"string"},"timeZone":{"type":"string"}}},"SignatureCreateRequest":{"type":"object","additionalProperties":false,"required":["signer","signature","consent"],"properties":{"documentId":{"type":"string","nullable":true},"documentType":{"type":"string","default":"case"},"documentTitle":{"type":"string","nullable":true},"signer":{"$ref":"#/components/schemas/SignatureSigner"},"signature":{"$ref":"#/components/schemas/SignatureImageInput"},"consent":{"type":"boolean","enum":[true]},"signedAt":{"type":"string","format":"date-time"},"meta":{"$ref":"#/components/schemas/SignatureSubmissionMeta"}}},"SignatureCreateResponse":{"type":"object","additionalProperties":false,"required":["success","id","message","signedAt","s3Key"],"properties":{"success":{"type":"boolean","enum":[true]},"id":{"type":"string","format":"uuid"},"message":{"type":"string"},"signedAt":{"type":"string","format":"date-time"},"s3Key":{"type":"string","nullable":true,"description":"Storage key, or null when image upload failed but the audit record persisted."}}},"SignatureRecord":{"type":"object","additionalProperties":false,"required":["id","documentId","documentType","documentTitle","signer","signatureType","signatureText","hasImage","signedAt","createdAt"],"properties":{"id":{"type":"string","format":"uuid"},"documentId":{"type":"string","nullable":true},"documentType":{"type":"string"},"documentTitle":{"type":"string","nullable":true},"signer":{"$ref":"#/components/schemas/SignatureSigner"},"signatureType":{"type":"string","enum":["typed","draw"]},"signatureText":{"type":"string","nullable":true},"hasImage":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}}},"SignatureSummary":{"type":"object","additionalProperties":false,"required":["id","documentId","documentType","documentTitle","signer","signatureType","signedAt"],"properties":{"id":{"type":"string","format":"uuid"},"documentId":{"type":"string","nullable":true},"documentType":{"type":"string"},"documentTitle":{"type":"string","nullable":true},"signer":{"$ref":"#/components/schemas/SignatureSigner"},"signatureType":{"type":"string","enum":["typed","draw"]},"hasImage":{"type":"boolean"},"signedAt":{"type":"string","format":"date-time"}}},"DocumentSignaturesResponse":{"type":"object","additionalProperties":false,"required":["documentId","count","signatures"],"properties":{"documentId":{"type":"string"},"count":{"type":"integer","minimum":0},"signatures":{"type":"array","items":{"$ref":"#/components/schemas/SignatureSummary"}}}},"UserSignaturesResponse":{"type":"object","additionalProperties":false,"required":["userId","count","signatures"],"properties":{"userId":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":100},"signatures":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/SignatureSummary"}}}},"SignatureErrorResponse":{"type":"object","additionalProperties":false,"required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"detail":{"type":"string"}}},"PlanFolder":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid","description":"Folder UUID"},"externalId":{"type":"string","nullable":true,"description":"External identifier for integrations"},"name":{"type":"string","description":"Folder name"},"parentId":{"type":"string","format":"uuid","nullable":true,"description":"Parent folder UUID (null for root)"},"visibility":{"type":"string","enum":["private","shared","domain"],"description":"Folder visibility scope"},"emailDomain":{"type":"string","nullable":true,"description":"Domain for domain-scoped sharing"},"sharedEmailDomains":{"type":"array","items":{"type":"string"},"description":"Email domains the folder is shared with"},"sharedOrgIds":{"type":"array","items":{"type":"string"},"description":"Org IDs the folder is shared with"},"ownerId":{"type":"string","description":"Owner user ID"},"isOwn":{"type":"boolean","description":"Whether the authenticated user owns this folder"},"planCount":{"type":"integer","description":"Number of plans in this folder"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"metadata":{"type":"object","additionalProperties":true,"description":"Arbitrary metadata"}}},"PageInfo":{"type":"object","required":["limit","hasMore","nextCursor"],"properties":{"limit":{"type":"integer","minimum":1,"maximum":100},"hasMore":{"type":"boolean"},"nextCursor":{"type":"string","nullable":true}}},"AsyncJobLinks":{"type":"object","required":["self","result","cancel"],"properties":{"self":{"type":"string"},"result":{"type":"string"},"cancel":{"type":"string"}}},"AsyncJobSubmission":{"type":"object","required":["ok","async","jobId","jobType","status","jobUrl","resultUrl","cancelUrl","links"],"properties":{"ok":{"type":"boolean","enum":[true]},"async":{"type":"boolean","enum":[true]},"jobId":{"type":"string"},"jobType":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","complete","failed","dead_letter","cancelled"]},"jobUrl":{"type":"string"},"resultUrl":{"type":"string"},"cancelUrl":{"type":"string"},"pollUrl":{"type":"string"},"requestId":{"type":"string"},"reused":{"type":"boolean"},"message":{"type":"string"},"links":{"$ref":"#/components/schemas/AsyncJobLinks"}}},"CaseImportSubmission":{"type":"object","required":["files"],"description":"For creation, employerName and policyPeriod are required and caseId is optional. For an existing-case update, provide targetCaseId plus expectedVersion; caseId must be omitted. Setup and contribution fields apply only to creation and are never used to erase existing-case state. With case supplied, employerName and policyPeriod can come from that case; targetCaseId and automatic mode are not allowed.","properties":{"files":{"type":"array","minItems":1,"maxItems":10,"description":"PDF, PNG, JPEG, XLSX, XLS, CSV, or DOCX originals. Each file is limited to 25 MB and is retained before parsing begins.","items":{"type":"string","format":"binary"}},"mode":{"type":"string","enum":["automatic","review"],"default":"review"},"employerName":{"type":"string","minLength":1,"maxLength":255,"description":"Required when creating a new case; omitted target-case values are loaded from the current case."},"policyPeriod":{"type":"string","minLength":1,"maxLength":100,"description":"Required when creating a new case; omitted target-case values are loaded from the current case."},"caseId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","maxLength":100,"description":"Optional caller-assigned id for the new case."},"targetCaseId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","maxLength":100,"description":"Existing case to update. Mutually exclusive with caseId and requires expectedVersion."},"expectedVersion":{"type":"integer","minimum":1,"description":"Current target-case row version. It is retained as the review base and sent as If-Match when committing."},"benefitTypes":{"type":"array","maxItems":10,"items":{"type":"string","minLength":1,"maxLength":64}},"defaultBenefitType":{"type":"string","default":"medical","maxLength":64},"carrier":{"type":"string","maxLength":100},"enrollmentTiers":{"type":"array","minItems":1,"maxItems":20,"items":{"$ref":"#/components/schemas/EnrollmentTier"}},"contributionSettings":{"type":"object","additionalProperties":true},"employer":{"type":"object","additionalProperties":true},"planLinks":{"type":"object","additionalProperties":true},"parseOptions":{"type":"object","additionalProperties":false,"properties":{"forceAI":{"type":"boolean","default":false},"includeRawText":{"type":"boolean","default":false}}},"case":{"allOf":[{"$ref":"#/components/schemas/VersionedCaseWriteRequest"}],"description":"Optional externally extracted case JSON. In multipart requests send a text field containing JSON (curl --form case=<ready.json), not a file part. Restricted to new-case mode=review. Every plan requires sourceFileIndex referencing an uploaded original. The server retains and binds originals, marks data externally supplied and unverified, and returns a completed review candidate without invoking the parser. A separate commit is required."}}},"CaseImportAcceptedResponse":{"allOf":[{"$ref":"#/components/schemas/AsyncJobSubmission"},{"type":"object","required":["caseImportId","mode","filesAccepted","importUrl","commitUrl"],"properties":{"caseImportId":{"type":"string"},"mode":{"type":"string","enum":["automatic","review"]},"operation":{"type":"string","enum":["create","update"]},"targetCaseId":{"type":"string"},"expectedVersion":{"type":"integer","minimum":1},"filesAccepted":{"type":"integer","minimum":1,"maximum":10},"importUrl":{"type":"string"},"commitUrl":{"type":"string"},"inputMode":{"type":"string","enum":["supplied"],"description":"Present when externally extracted case data was supplied."},"requiresReview":{"type":"boolean","description":"Supplied data requires a separate review commit; no parser acceptance is recorded."}}}]},"CaseImportParsingSummary":{"type":"object","additionalProperties":false,"properties":{"filesProcessed":{"type":"integer","minimum":0},"filesSucceeded":{"type":"integer","minimum":0},"filesFailed":{"type":"integer","minimum":0},"plansExtracted":{"type":"integer","minimum":0},"errors":{"type":"array","items":{"type":"object","additionalProperties":false,"properties":{"fileName":{"type":"string"},"error":{"type":"string"},"message":{"type":"string","nullable":true}}}},"details":{"type":"array","items":{"type":"object","additionalProperties":true}},"skipped":{"type":"boolean","description":"True for supplied extraction; no parser was invoked."},"source":{"type":"string","description":"external-extraction for supplied data."}}},"CaseImportRetryMetadata":{"type":"object","additionalProperties":false,"required":["attempt","maxAttempts","manualRetries","retryable","nextAttemptAt","lastFailureAt","deadLetteredAt"],"properties":{"attempt":{"type":"integer","minimum":0},"maxAttempts":{"type":"integer","minimum":1,"maximum":10},"manualRetries":{"type":"integer","minimum":0},"retryable":{"type":"boolean"},"nextAttemptAt":{"type":"string","format":"date-time","nullable":true},"lastFailureAt":{"type":"string","format":"date-time","nullable":true},"deadLetteredAt":{"type":"string","format":"date-time","nullable":true}}},"CaseImportLinks":{"type":"object","required":["self","job","result","commit","retry","cancel"],"properties":{"self":{"type":"string"},"job":{"type":"string"},"result":{"type":"string"},"commit":{"type":"string"},"retry":{"type":"string"},"cancel":{"type":"string"}}},"CaseImportResource":{"type":"object","required":["id","jobId","type","mode","status","progress","retry","links"],"properties":{"id":{"type":"string"},"jobId":{"type":"string"},"type":{"type":"string","enum":["case_import"]},"mode":{"type":"string","enum":["automatic","review"]},"status":{"type":"string","enum":["queued","processing","completed","failed","dead_letter","cancelled"]},"progress":{"type":"integer","minimum":0,"maximum":100},"error":{"type":"string","nullable":true},"candidateCase":{"allOf":[{"$ref":"#/components/schemas/CaseData"}],"nullable":true},"parsing":{"allOf":[{"$ref":"#/components/schemas/CaseImportParsingSummary"}],"nullable":true},"commitState":{"type":"string","nullable":true,"enum":["ready","processing","completed","failed","retrying","blocked","conflict"]},"operation":{"type":"string","enum":["create","update"]},"targetCaseId":{"type":"string","nullable":true},"baseVersion":{"type":"integer","minimum":1,"nullable":true},"currentVersion":{"type":"integer","minimum":1,"nullable":true},"proposedChanges":{"type":"object","additionalProperties":true,"nullable":true,"description":"JSON Merge Patch generated from the review-time target snapshot. Touched benefit buckets contain existing plans plus parsed additions; untouched fields and buckets are omitted."},"mapping":{"type":"object","additionalProperties":true,"nullable":true},"requiresReview":{"type":"boolean"},"committedCase":{"allOf":[{"$ref":"#/components/schemas/CaseData"}],"nullable":true},"retry":{"$ref":"#/components/schemas/CaseImportRetryMetadata"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"links":{"$ref":"#/components/schemas/CaseImportLinks"},"inputMode":{"type":"string","enum":["supplied"],"nullable":true}}},"CaseImportReadResponse":{"type":"object","required":["ok","caseImport"],"properties":{"ok":{"type":"boolean","enum":[true]},"caseImport":{"$ref":"#/components/schemas/CaseImportResource"},"requestId":{"type":"string"}}},"CaseImportListResponse":{"type":"object","additionalProperties":false,"required":["ok","items","total","pageInfo"],"properties":{"ok":{"type":"boolean","enum":[true]},"items":{"type":"array","items":{"$ref":"#/components/schemas/CaseImportResource"}},"total":{"type":"integer","minimum":0},"pageInfo":{"$ref":"#/components/schemas/PageInfo"},"requestId":{"type":"string"}}},"CaseImportRetryResponse":{"type":"object","additionalProperties":false,"required":["ok","caseImport"],"properties":{"ok":{"type":"boolean","enum":[true]},"caseImport":{"$ref":"#/components/schemas/CaseImportResource"},"replayed":{"type":"boolean"},"requestId":{"type":"string"}}},"CaseImportCommitRequest":{"type":"object","additionalProperties":false,"properties":{"case":{"$ref":"#/components/schemas/VersionedCaseWriteRequest"},"proposedChanges":{"type":"object","minProperties":1,"additionalProperties":true,"description":"Optional reviewed merge patch for an existing-case import. The server retains its durable import marker and commits with the original expectedVersion."}}},"CaseImportCommitResponse":{"allOf":[{"$ref":"#/components/schemas/CaseWriteResponse"},{"type":"object","required":["caseImportId","commitState"],"properties":{"caseImportId":{"type":"string"},"commitState":{"type":"string","enum":["completed"]},"replayed":{"type":"boolean"},"requestId":{"type":"string"}}}]},"PdfExtractionAcceptedResponse":{"allOf":[{"$ref":"#/components/schemas/AsyncJobSubmission"},{"type":"object","required":["success","job","pollAfterMs"],"properties":{"success":{"type":"boolean","enum":[true]},"job":{"type":"object","required":["id","jobType","status"],"properties":{"id":{"type":"string"},"jobType":{"type":"string"},"status":{"type":"string","enum":["queued","processing","complete","failed"]},"error":{"type":"string","nullable":true},"fileName":{"type":"string","nullable":true},"fileSize":{"type":"integer","nullable":true},"mimeType":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time","nullable":true},"updatedAt":{"type":"string","format":"date-time","nullable":true}}},"pollAfterMs":{"type":"integer","minimum":1}}}]},"JobSummary":{"type":"object","required":["id","type","status","createdAt","updatedAt","hasResult"],"properties":{"id":{"type":"string"},"type":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","complete","failed","cancelled"]},"progress":{"type":"number","nullable":true,"minimum":0,"maximum":100},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"hasResult":{"type":"boolean"},"error":{"type":"string","nullable":true}}},"JobListResponse":{"type":"object","required":["ok","items","total","pageInfo"],"properties":{"ok":{"type":"boolean","enum":[true]},"items":{"type":"array","items":{"$ref":"#/components/schemas/JobSummary"}},"total":{"type":"integer","minimum":0},"pageInfo":{"$ref":"#/components/schemas/PageInfo"}}},"JobDetail":{"type":"object","required":["id","type","status","createdAt","updatedAt","meta"],"properties":{"id":{"type":"string"},"type":{"type":"string"},"status":{"type":"string","enum":["queued","processing","completed","complete","failed","cancelled"]},"progress":{"type":"number","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"result":{"type":"object","nullable":true,"additionalProperties":true},"error":{"type":"string","nullable":true},"meta":{"type":"object","required":["hasResult","errorType"],"properties":{"hasResult":{"type":"boolean"},"errorType":{"type":"string","nullable":true}}}}},"JobDetailResponse":{"type":"object","required":["success","job"],"properties":{"success":{"type":"boolean","enum":[true]},"job":{"$ref":"#/components/schemas/JobDetail"}}},"JobCancelResponse":{"type":"object","required":["success","message"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"}}},"JobResultResponse":{"type":"object","required":["success","result"],"properties":{"success":{"type":"boolean","enum":[true]},"result":{"type":"object","additionalProperties":true}}},"JobStatsResponse":{"type":"object","required":["success","stats"],"properties":{"success":{"type":"boolean","enum":[true]},"stats":{"type":"object","required":["period","totalJobs","byStatus","byType"],"properties":{"period":{"type":"string"},"totalJobs":{"type":"integer","minimum":0},"byStatus":{"type":"object","additionalProperties":{"type":"integer","minimum":0}},"byType":{"type":"object","additionalProperties":{"type":"integer","minimum":0}}}}}},"JobTypesResponse":{"type":"object","required":["success","types"],"properties":{"success":{"type":"boolean","enum":[true]},"types":{"type":"array","items":{"type":"object","required":["type","description","category"],"properties":{"type":{"type":"string"},"description":{"type":"string"},"category":{"type":"string"}}}}}},"CursorErrorResponse":{"type":"object","required":["ok","error","message"],"properties":{"ok":{"type":"boolean","enum":[false]},"error":{"type":"string","enum":["invalid_cursor","pagination_mode_conflict"]},"message":{"type":"string"},"requestId":{"type":"string"}}},"CaseListResponse":{"type":"object","required":["ok","items","pageInfo"],"properties":{"ok":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CaseMeta"}},"total":{"type":"integer","minimum":0},"pageInfo":{"$ref":"#/components/schemas/PageInfo"}}},"CasePlanSummary":{"type":"object","required":["planId"],"properties":{"userId":{"type":"string"},"caseId":{"type":"string"},"planId":{"type":"string"},"planName":{"type":"string","nullable":true},"carrier":{"type":"string","nullable":true},"planType":{"type":"string","nullable":true,"enum":["current","proposed","renewal","alternate"]},"benefitType":{"type":"string","nullable":true,"enum":["medical","dental","vision","life","std","ltd","voluntary","peo","self-insured"]},"rateStructure":{"type":"string","nullable":true},"totalEnrolled":{"type":"integer"},"annualPremiumTotal":{"type":"number","nullable":true},"annualErCost":{"type":"number","nullable":true},"annualEeCost":{"type":"number","nullable":true},"updatedAtMs":{"type":"integer","format":"int64","nullable":true}}},"CasePlanListResponse":{"type":"object","required":["ok","items","pageInfo"],"properties":{"ok":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/CasePlanSummary"}},"pageInfo":{"$ref":"#/components/schemas/PageInfo"}}},"PlanLibraryCursorListResponse":{"type":"object","required":["ok","items","pageInfo"],"properties":{"ok":{"type":"boolean","enum":[true]},"items":{"type":"array","items":{"$ref":"#/components/schemas/PlanLibraryItem"}},"total":{"type":"integer","minimum":0},"orgId":{"type":"string","nullable":true},"ts":{"type":"string","format":"date-time"},"pageInfo":{"$ref":"#/components/schemas/PageInfo"}}},"AssistantCommandContinuation":{"type":"object","additionalProperties":false,"required":["version","contractVersion","commandId","revision","intentId","caseId","conversationId","params"],"properties":{"version":{"type":"integer","enum":[1]},"contractVersion":{"type":"integer","enum":[1]},"commandId":{"type":"string","maxLength":128},"revision":{"type":"integer","minimum":1,"maximum":10000},"intentId":{"type":"string","maxLength":128},"caseId":{"type":"string","maxLength":128},"organizationId":{"type":"string","nullable":true,"maxLength":128},"conversationId":{"type":"string","maxLength":128},"status":{"type":"string","enum":["unfinished","committed"]},"params":{"type":"object","description":"Bounded intent-specific partial parameters validated by AssistantCommandContract.","additionalProperties":true},"bindings":{"type":"array","maxItems":100,"items":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","maxLength":24},"id":{"type":"string","maxLength":128},"label":{"type":"string","maxLength":160},"benefitType":{"type":"string","nullable":true}}}},"question":{"type":"object","nullable":true,"additionalProperties":false,"properties":{"id":{"type":"string","maxLength":128},"slot":{"type":"string","enum":["benefitType","scope","sheetId","fromPlanId","toPlanId","tierId","model","operation","metric","planId","designation","count","employerPercent","name","baseline","model.employeePercent","model.dependentPercent","model.basis","model.period"]},"prompt":{"type":"string","maxLength":500},"options":{"type":"array","maxItems":40,"items":{"type":"object","additionalProperties":false,"properties":{"id":{"type":"string","maxLength":128},"label":{"type":"string","maxLength":160},"value":{}}}}}},"hints":{"type":"object","additionalProperties":false,"properties":{"groupName":{"type":"string","maxLength":160},"sheetName":{"type":"string","maxLength":160},"fromName":{"type":"string","maxLength":160},"toName":{"type":"string","maxLength":160}}},"resultReference":{"type":"object","description":"Bounded owner-verified candidate IDs and metric evidence. Revalidated on resume.","additionalProperties":true},"workId":{"type":"string","maxLength":160},"runId":{"type":"string","maxLength":160}}},"AssistantFileWorkContinuation":{"type":"object","additionalProperties":false,"required":["version","workId","runId","planRevision","goal","caseId","scope","sources","steps","clarification","artifactRefs","save","status","reason"],"properties":{"version":{"type":"integer","enum":[1]},"workId":{"type":"string","maxLength":160},"runId":{"type":"string","maxLength":160},"planRevision":{"type":"integer","minimum":1},"goal":{"type":"string","maxLength":6000},"caseId":{"type":"string","maxLength":128,"nullable":true},"scope":{"type":"object","additionalProperties":false,"required":["benefits","basis","prepareQcc","draft"],"properties":{"benefits":{"type":"array","items":{"type":"string","enum":["deductible","out-of-pocket","premium","network","benefits","exclusions"]},"maxItems":8},"basis":{"type":"string","enum":["benefits-only","monthly","annual","unknown"]},"prepareQcc":{"type":"boolean"},"draft":{"type":"boolean"}}},"sources":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["sourceId","contentDigest","displayName","included","role","documentId","documentVersion","expiresAt"],"properties":{"sourceId":{"type":"string","maxLength":160},"contentDigest":{"type":"string","maxLength":160},"displayName":{"type":"string","maxLength":240},"included":{"type":"boolean"},"role":{"type":"string","enum":["unknown","current","renewal","reference"]},"documentId":{"type":"string","maxLength":160,"nullable":true},"documentVersion":{"type":"integer","minimum":0},"expiresAt":{"type":"integer","minimum":0}}},"maxItems":8},"steps":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","operation","dependsOn","inputFingerprint","status","attemptId","ownerRef","receipts"],"properties":{"id":{"type":"string","maxLength":40},"operation":{"type":"string","enum":["evidence","matches","parse","compare","draft","verify"]},"dependsOn":{"type":"array","items":{"type":"string","maxLength":40},"maxItems":6},"inputFingerprint":{"type":"string","maxLength":160},"status":{"type":"string","enum":["pending","running","complete","blocked","stale","uncertain","omitted"]},"attemptId":{"type":"string","maxLength":160,"nullable":true},"ownerRef":{"type":"string","maxLength":160,"nullable":true},"receipts":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["sourceId","contentDigest","jobId","parseOperationId"],"properties":{"sourceId":{"type":"string","maxLength":160},"contentDigest":{"type":"string","maxLength":160},"jobId":{"type":"string","maxLength":160},"parseOperationId":{"type":"string","maxLength":160,"nullable":true}}},"maxItems":8}}},"maxItems":6},"clarification":{"type":"object","additionalProperties":false,"required":["id","kind","planRevision","sourceFingerprint","prompt","options","answer"],"properties":{"id":{"type":"string","maxLength":160},"kind":{"type":"string","enum":["source_roles","rate_basis","enrollment","scope"]},"planRevision":{"type":"integer","minimum":0},"sourceFingerprint":{"type":"string","maxLength":160},"prompt":{"type":"string","maxLength":500},"options":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["id","label","sourceId","unitId","quote"],"properties":{"id":{"type":"string","maxLength":160},"label":{"type":"string","maxLength":240},"sourceId":{"type":"string","maxLength":160,"nullable":true},"unitId":{"type":"string","maxLength":160,"nullable":true},"quote":{"type":"string","maxLength":1000}}},"maxItems":10},"answer":{"type":"object","additionalProperties":false,"required":["choiceId","actorId","answeredAt"],"properties":{"choiceId":{"type":"string","maxLength":160},"actorId":{"type":"string","maxLength":160},"answeredAt":{"type":"integer","minimum":0}},"nullable":true}},"nullable":true},"artifactRefs":{"type":"object","additionalProperties":false,"required":["evidencePacketId","draftDocumentId","draftDigest","draftRevision","qccSessionId","qccLocalOnly"],"properties":{"evidencePacketId":{"type":"string","maxLength":160,"nullable":true},"draftDocumentId":{"type":"string","maxLength":160,"nullable":true},"draftDigest":{"type":"string","maxLength":160,"nullable":true},"draftRevision":{"type":"integer","minimum":0},"qccSessionId":{"type":"string","maxLength":160,"nullable":true},"qccLocalOnly":{"type":"boolean"}}},"save":{"type":"object","additionalProperties":false,"required":["metadata","sources","checkedAt"],"properties":{"metadata":{"type":"string","enum":["local","acknowledged","conflict"]},"sources":{"type":"string","enum":["temporary","partial","verified","expired"]},"checkedAt":{"type":"integer","minimum":0}}},"status":{"type":"string","enum":["planned","running","blocked","paused","verifying","awaiting_approval","verified","failed","cancelled"]},"reason":{"type":"string","maxLength":300}},"description":"Advisory bounded continuation data. No rollback, Apply authority, original bytes or signed URLs. Owners must reauthorize and reconcile on resume."}}},"x-webhooks":{"description":"Planlined supports outbound webhooks for real-time event notifications. Configure webhooks in your organization settings or via the API.","events":{"case.created":{"description":"Fired when a new case is created","payload":{"type":"object","properties":{"event":{"type":"string","enum":["case.created"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"caseId":{"type":"string"},"employerName":{"type":"string"},"createdBy":{"type":"string"},"orgId":{"type":"string","nullable":true}}}}},"example":{"event":"case.created","timestamp":"2025-01-15T10:30:00Z","data":{"caseId":"case-acme-2025","employerName":"Acme Corporation","createdBy":"user_abc123","orgId":"org_xyz789"}}},"case.updated":{"description":"Fired when a case is updated","payload":{"type":"object","properties":{"event":{"type":"string","enum":["case.updated"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"caseId":{"type":"string"},"updatedBy":{"type":"string"},"changes":{"type":"array","items":{"type":"string"}}}}}}},"case.shared":{"description":"Fired when a case is shared with another user or organization","payload":{"type":"object","properties":{"event":{"type":"string","enum":["case.shared"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"caseId":{"type":"string"},"sharedBy":{"type":"string"},"sharedWith":{"type":"string"},"shareType":{"type":"string","enum":["user","org","link"]}}}}}},"export.completed":{"description":"Fired when an export job completes","payload":{"type":"object","properties":{"event":{"type":"string","enum":["export.completed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"exportId":{"type":"string"},"caseId":{"type":"string"},"format":{"type":"string"},"downloadUrl":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"}}}}}},"parse.completed":{"description":"Fired when document parsing completes","payload":{"type":"object","properties":{"event":{"type":"string","enum":["parse.completed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"requestId":{"type":"string"},"status":{"type":"string","enum":["success","partial","failed"]},"plansExtracted":{"type":"integer"},"pagesProcessed":{"type":"integer"}}}}}},"subscription.updated":{"description":"Fired when a subscription status changes","payload":{"type":"object","properties":{"event":{"type":"string","enum":["subscription.updated"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"subscriptionId":{"type":"string"},"userId":{"type":"string"},"previousPlan":{"type":"string"},"newPlan":{"type":"string"},"status":{"type":"string","enum":["active","canceled","past_due"]}}}}}},"case.deleted":{"description":"Fired when a case is deleted","payload":{"type":"object","properties":{"event":{"type":"string","enum":["case.deleted"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"caseId":{"type":"string"},"deletedBy":{"type":"string"},"orgId":{"type":"string","nullable":true}}}}}},"report.viewed":{"description":"Fired when someone views a shared report. Includes engagement metrics.","payload":{"type":"object","properties":{"event":{"type":"string","enum":["report.viewed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"reportId":{"type":"string","description":"Unique identifier for the shared report"},"shareUrl":{"type":"string","description":"Full URL of the shared report"},"sessionId":{"type":"string","description":"Unique session ID for this viewing session"},"viewerIp":{"type":"string","description":"IP address of the viewer (anonymized)"},"device":{"type":"string","enum":["desktop","tablet","mobile"],"description":"Device type"},"browser":{"type":"string","description":"Browser name (Chrome, Safari, Firefox, etc.)"},"referrer":{"type":"string","nullable":true,"description":"Referring URL if available"},"engagement":{"type":"object","description":"Engagement metrics for this viewing session","properties":{"timeOnPageSeconds":{"type":"integer","description":"Total seconds spent viewing the report"},"scrollDepthPercent":{"type":"integer","minimum":0,"maximum":100,"description":"Maximum scroll depth reached (0-100)"},"sectionsViewed":{"type":"array","items":{"type":"string"},"description":"List of report sections viewed"},"modelerOpened":{"type":"boolean","description":"Whether the contribution modeler was opened"},"modelerScenarios":{"type":"integer","description":"Number of contribution scenarios created"},"pdfDownloaded":{"type":"boolean","description":"Whether a PDF was downloaded"},"tabsSwitched":{"type":"integer","description":"Number of benefit type tabs switched"}}}}}}},"example":{"event":"report.viewed","timestamp":"2026-03-31T14:30:00Z","data":{"reportId":"rpt_abc123","shareUrl":"https://app.trybart.com/shared/rpt_abc123","sessionId":"sess_xyz789","viewerIp":"192.168.1.x","device":"desktop","browser":"Chrome","referrer":"https://email.example.com/","engagement":{"timeOnPageSeconds":145,"scrollDepthPercent":85,"sectionsViewed":["benefits","rates","cost-analysis"],"modelerOpened":true,"modelerScenarios":2,"pdfDownloaded":false,"tabsSwitched":3}}}},"report.generated":{"description":"Fired when a shareable report is generated","payload":{"type":"object","properties":{"event":{"type":"string","enum":["report.generated"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"reportId":{"type":"string"},"caseId":{"type":"string"},"shareUrl":{"type":"string"},"benefitTypes":{"type":"array","items":{"type":"string"},"description":"Benefit types included in the report"},"expiresAt":{"type":"string","format":"date-time","nullable":true},"createdBy":{"type":"string"}}}}}},"plan.created":{"description":"Fired when a plan is added to a case","payload":{"type":"object","properties":{"event":{"type":"string","enum":["plan.created"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"planId":{"type":"string"},"caseId":{"type":"string"},"planName":{"type":"string"},"benefitType":{"type":"string","enum":["medical","dental","vision","life","std","ltd"]},"planType":{"type":"string","enum":["current","renewal","proposed"]},"carrier":{"type":"string","nullable":true}}}}}},"plan.updated":{"description":"Fired when a plan is modified","payload":{"type":"object","properties":{"event":{"type":"string","enum":["plan.updated"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"planId":{"type":"string"},"caseId":{"type":"string"},"planName":{"type":"string"},"changes":{"type":"array","items":{"type":"string"},"description":"List of changed fields"},"updatedBy":{"type":"string"}}}}}},"plan.deleted":{"description":"Fired when a plan is removed from a case","payload":{"type":"object","properties":{"event":{"type":"string","enum":["plan.deleted"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"planId":{"type":"string"},"caseId":{"type":"string"},"planName":{"type":"string"},"deletedBy":{"type":"string"}}}}}},"plan.linked":{"description":"Fired when plans are linked together (current to renewal/proposed)","payload":{"type":"object","properties":{"event":{"type":"string","enum":["plan.linked"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"caseId":{"type":"string"},"currentPlanId":{"type":"string"},"linkedPlanId":{"type":"string"},"linkType":{"type":"string","enum":["renewal","proposed"]}}}}}},"parse.failed":{"description":"Fired when document parsing fails","payload":{"type":"object","properties":{"event":{"type":"string","enum":["parse.failed"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"documentId":{"type":"string"},"filename":{"type":"string"},"errorCode":{"type":"string","enum":["UNSUPPORTED_FORMAT","CORRUPT_FILE","NO_PLANS_FOUND","AI_ERROR","TIMEOUT"]},"errorMessage":{"type":"string"},"parserAttempted":{"type":"string","nullable":true}}}}}}},"security":{"description":"Webhook requests are signed using HMAC-SHA256. Verify the X-Webhook-Signature header to ensure authenticity. The signed payload is the timestamp, a literal dot, then the raw JSON body.","headers":{"X-Webhook-Signature":"sha256=<hex HMAC-SHA256 of \"{timestamp}.{body}\" using your webhook secret>","X-Webhook-Timestamp":"Unix timestamp of when the webhook was sent","X-Webhook-Event":"The event type (e.g., case.created)","X-Webhook-Delivery-Id":"Unique id for this delivery attempt"},"verification":"\n// Node.js verification example\nconst crypto = require('crypto');\n\n// signature: the X-Webhook-Signature header (\"sha256=...\")\n// timestamp: the X-Webhook-Timestamp header\n// body: the raw JSON request body, as sent\nfunction verifyWebhook(body, signature, timestamp, secret) {\n  const expectedSig =\n    'sha256=' +\n    crypto\n      .createHmac('sha256', secret)\n      .update(`${timestamp}.${body}`)\n      .digest('hex');\n  const a = Buffer.from(signature);\n  const b = Buffer.from(expectedSig);\n  return a.length === b.length && crypto.timingSafeEqual(a, b);\n}\n    "},"retries":{"description":"Failed webhook deliveries are retried with exponential backoff. max_retries defaults to 5, so a delivery is abandoned after the 30-minute attempt.","schedule":["immediate","30 seconds","1 minute","5 minutes","30 minutes"],"maxRetries":5,"successCodes":"Any 2xx response is treated as success; anything else is retried."}},"x-authentication":{"description":"Planlined uses AWS Cognito for authentication with JWT tokens. API keys are available for server-to-server integrations.","flows":{"cognito-hosted-ui":{"description":"Recommended for web applications. Redirects user to Cognito hosted UI for login.","steps":["1. Redirect user to Cognito hosted UI login page","2. User authenticates (email/password, Google, etc.)","3. Cognito redirects back with authorization code","4. Exchange code for tokens via POST /api/cognito/token","5. Use access_token in Authorization header for API calls"],"example":{"tokenExchange":{"method":"POST","url":"/api/cognito/token","body":{"code":"AUTHORIZATION_CODE_FROM_CALLBACK","redirectUri":"https://yourapp.com/callback"},"response":{"ok":true,"accessToken":"eyJhbGciOiJSUzI1NiIs...","idToken":"eyJhbGciOiJSUzI1NiIs...","refreshToken":"eyJjdHkiOiJKV1QiLCJl...","expiresIn":3600}}}},"token-refresh":{"description":"Refresh expired access tokens without re-authentication.","steps":["1. Store refresh_token securely","2. When access_token expires (or returns 401), call refresh endpoint","3. Use new access_token for subsequent requests"],"example":{"method":"POST","url":"/api/cognito/refresh","body":{"refreshToken":"REFRESH_TOKEN"},"response":{"ok":true,"accessToken":"eyJhbGciOiJSUzI1NiIs...","expiresIn":3600}}},"api-key":{"description":"For server-to-server integrations. API keys may be issued with an expiration and can always be revoked.","steps":["1. Generate API key in organization settings or via POST /api/api-keys","2. Include X-API-Key header in all requests","3. API keys have scoped permissions set at creation"],"scopes":[{"name":"cases:read","description":"Read case data"},{"name":"cases:write","description":"Create and modify cases"},{"name":"plans:read","description":"Read plan library items"},{"name":"plans:write","description":"Modify plan library"},{"name":"exports:write","description":"Generate exports"},{"name":"cases:import","description":"Parse files and import cases"},{"name":"webhooks:write","description":"Manage webhook subscriptions"},{"name":"integrations:read / integrations:write","description":"Read or manage third-party integrations"}],"example":{"headers":{"X-API-Key":"bart_sk_xxxxxxxxxxxxxxxxxxxxxxxx","Content-Type":"application/json"}}},"mfa":{"description":"Multi-factor authentication for enhanced security.","supportedMethods":["TOTP (Authenticator App)","SMS"],"endpoints":[{"path":"/api/cognito/mfa/status","description":"Check if MFA is enabled"},{"path":"/api/cognito/mfa/setup","description":"Begin MFA setup"},{"path":"/api/cognito/mfa/verify","description":"Verify MFA code"},{"path":"/api/cognito/mfa/disable","description":"Disable MFA"}]}},"tokenExpiration":{"accessToken":"1 hour","refreshToken":"30 days","recommendation":"Implement token refresh before expiration. Store refresh tokens securely (httpOnly cookies or secure storage)."}},"x-tagGroups":[{"name":"Getting Started","tags":["System","Session"]},{"name":"Core Features","tags":["Cases","Plans","Plan Library","Plan Templates","Contribution Templates"]},{"name":"Document Processing","tags":["Parse","AI"]},{"name":"Reporting & Export","tags":["Reports","Export","Web Reports"]},{"name":"Data & Analytics","tags":["Market Data","Costing","Analytics"]},{"name":"Organization & Users","tags":["Organizations","User","Invitations","Subscriptions","Trial"]},{"name":"Integrations","tags":["Integrations","Cloud Storage","Webhooks","Assets"]},{"name":"Developer Tools","tags":["API Keys","Feature Flags","Realtime","Wizard","Azure","Location"]},{"name":"Election Portal","tags":["Election Portal: Admin","Election Portal: Employee"]}],"externalDocs":{"description":"Planlined Developer Documentation","url":"https://app.trybart.com/developers"}}