{"openapi":"3.0.0","info":{"title":"BlueHive API","description":"Core API server that powers everything BlueHive — from BlueHive AI and our employer/provider portals to bluehive.com itself","version":"1.0.0.1"},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key for accessing BlueHive API endpoints. Format: \"ApiKey <your-api-key>\" or \"Bearer <your-api-key>\""}},"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"],"description":"Health status"}},"required":["status"]},"VersionResponse":{"type":"object","properties":{"version":{"type":"string","description":"Current API version"}},"required":["version"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string","description":"Error type"},"message":{"type":"string","description":"Error message"},"statusCode":{"type":"number","description":"HTTP status code"}},"required":["error","message","statusCode"]},"ProviderLookupResponse":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"List of matching providers"},"count":{"type":"number","description":"Number of providers found"}},"required":["providers","count"]}}},"paths":{"/v1/health":{"get":{"operationId":"healthCheck","summary":"Health Check","tags":["Health & Status"],"description":"Check the service health and ensure the API is running properly.","security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}}}}},"/v1/version":{"get":{"operationId":"getApiVersion","summary":"API Version","tags":["Health & Status"],"description":"Retrieve the current version of the BlueHive API.","security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"}},"required":["version"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/providers/lookup":{"get":{"operationId":"searchProviders","summary":"Provider Search","tags":["Healthcare Providers"],"description":"Search for healthcare providers by NPI number, name, or location proximity.","parameters":[{"schema":{"type":"string"},"in":"query","name":"firstname","required":false,"description":"Provider first name"},{"schema":{"type":"string"},"in":"query","name":"lastname","required":false,"description":"Provider last name"},{"schema":{"type":"string"},"in":"query","name":"npi","required":false,"description":"Provider NPI number"},{"schema":{"type":"string"},"in":"query","name":"zipcode","required":false,"description":"ZIP code to filter results by proximity"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"lastname":{"type":"string","description":"Provider last name or organization name"},"firstname":{"type":"string","description":"Provider first name"},"address_1":{"type":"string","description":"Primary address line"},"address_2":{"type":"string","description":"Secondary address line (suite, unit, etc.)"},"city":{"type":"string","description":"City"},"state_province":{"type":"string","description":"State or province code"},"country":{"type":"string","description":"Country code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"work_phone":{"type":"string","description":"Work phone number"},"fax_number":{"type":"string","description":"Fax number"},"npi":{"type":"string","description":"National Provider Identifier (NPI) number"},"distance":{"type":"number","description":"Distance in miles from the provided ZIP code"}},"required":["lastname","firstname","address_1","address_2","city","state_province","country","postal_code","work_phone","fax_number","npi","distance"]},"description":"List of matching providers"},"count":{"type":"number","description":"Number of providers found"}},"required":["providers","count"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/providers/search":{"get":{"operationId":"searchProvidersByZipcode","summary":"Search providers by zipcode","tags":["Provider Directory"],"description":"Search for healthcare providers near a given zipcode. Optionally filter by services and customize the search radius. When services are provided, only providers offering those services are returned with pricing info.","parameters":[{"schema":{"type":"string","minLength":5,"maxLength":10,"pattern":"^\\d{5}(-\\d{4})?$"},"in":"query","name":"zipcode","required":true,"description":"US postal code to search near (5-digit or ZIP+4 format)"},{"schema":{"type":"string","default":"25"},"in":"query","name":"radius","required":false,"description":"Search radius in miles (default: 25, max: 100)"},{"schema":{"type":"string"},"in":"query","name":"services","required":false,"description":"Comma-separated service IDs to filter by (optional)"},{"schema":{"type":"string"},"in":"query","name":"providerId","required":false,"description":"Comma-separated provider IDs to restrict results to (optional)"},{"schema":{"type":"string"},"in":"query","name":"employerId","required":false,"description":"Employer ID for employer-specific pricing (optional)"},{"schema":{"type":"string"},"in":"query","name":"brandId","required":false,"description":"Brand ID to filter services by brand (optional)"},{"schema":{"type":"string","default":"50"},"in":"query","name":"limit","required":false,"description":"Maximum number of providers to return (default: 50, max: 200)"}],"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"count":{"type":"number"},"zipcode":{"type":"string"},"radius":{"type":"number"},"providers":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"address":{"type":"object","properties":{"street1":{"type":"string"},"street2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"postalCode":{"type":"string"},"county":{"type":"string"},"country":{"type":"string"}}},"email":{"type":"string"},"logoURL":{"type":"string"},"phone_numbers":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"number":{"type":"string"}}}},"loc":{"type":"object","properties":{"type":{"type":"string"},"coordinates":{"type":"array","items":{"type":"number"}}}},"distance":{"type":"number","description":"Distance from zipcode in miles"},"url":{"type":"string"},"services":{"type":"array","items":{"type":"object","properties":{"serviceId":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"price":{"type":"number"}}}}}}}},"required":["status","count","zipcode","radius","providers"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"statusCode":{"type":"number"},"message":{"type":"string"},"code":{"type":"string"},"error":{"type":"string"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"statusCode":{"type":"number"},"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/v1/database/health":{"get":{"operationId":"checkDatabaseHealth","summary":"Database Health","tags":["Database & Monitoring"],"description":"Check MongoDB database connectivity and retrieve health statistics.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","error"],"description":"Database health status"},"database":{"type":"string","description":"Database name (hidden in production)"},"timestamp":{"type":"string","description":"Health check timestamp"},"stats":{"type":"object","description":"Database statistics (not available in production)","properties":{"collections":{"type":"number","description":"Number of collections"},"documents":{"type":"number","description":"Total number of documents"},"dataSize":{"type":"number","description":"Total data size in bytes"}}},"error":{"type":"string","description":"Error message if status is error"}},"required":["status","timestamp"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"database":{"type":"string","description":"Database name (hidden in production)"},"timestamp":{"type":"string"},"error":{"type":"string"}},"required":["status","timestamp","error"]}}}}}}},"/v1/fax/subscriptions/health":{"get":{"operationId":"getFaxSubscriptionHealth","summary":"Fax Subscription Health","tags":["Fax Services"],"description":"Returns webhook subscription status for fax providers.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/v1/fax/send":{"post":{"operationId":"sendFax","summary":"Send Fax","tags":["Fax Services"],"description":"Send a fax document to a specified number using the configured fax provider.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["to","document"],"properties":{"to":{"type":"string","description":"Recipient fax number (E.164 format preferred)"},"from":{"type":"string","description":"Sender fax number (optional, uses default if not provided)"},"subject":{"type":"string","description":"Subject line for the fax"},"document":{"type":"object","required":["content","contentType"],"properties":{"content":{"type":"string","description":"Base64 encoded document content"},"contentType":{"type":"string","description":"MIME type of the document","enum":["application/pdf","image/tiff","image/tif","image/jpeg","image/jpg","image/png","text/plain"]},"filename":{"type":"string","description":"Optional filename for the document"}}},"provider":{"type":"string","description":"Optional provider override (uses default if not specified)"}}}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique fax identifier"},"status":{"type":"string","enum":["queued","dialing","sending","delivered","failed","cancelled","retrying"],"description":"Current fax status"},"provider":{"type":"string","description":"Provider used to send the fax"},"to":{"type":"string","description":"Recipient fax number"},"from":{"type":"string","description":"Sender fax number"},"createdAt":{"type":"string","description":"ISO timestamp when fax was created"},"estimatedDelivery":{"type":"string","description":"Estimated delivery time (ISO timestamp)"}},"required":["id","status","provider","to","from","createdAt"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/send":{"post":{"operationId":"sendStoredFax","summary":"Send Stored Fax","tags":["Fax Services"],"description":"Send a previously received/stored fax document to a specified number.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["to"],"properties":{"to":{"type":"string","description":"Recipient fax number (E.164 format preferred)"},"from":{"type":"string","description":"Sender fax number (optional, uses default if not provided)"},"subject":{"type":"string","description":"Subject line for the fax"}}}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true,"description":"ID of the stored fax to send"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique fax identifier"},"status":{"type":"string","enum":["queued","dialing","sending","delivered","failed","cancelled","retrying"],"description":"Current fax status"},"provider":{"type":"string","description":"Provider used to send the fax"},"to":{"type":"string","description":"Recipient fax number"},"from":{"type":"string","description":"Sender fax number"},"createdAt":{"type":"string","description":"ISO timestamp when fax was created"},"estimatedDelivery":{"type":"string","description":"Estimated delivery time (ISO timestamp)"}},"required":["id","status","provider","to","from","createdAt"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/status/{id}":{"get":{"operationId":"getFaxStatus","summary":"Fax Status","tags":["Fax Services"],"description":"Retrieve the current status and details of a fax by its ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Fax ID returned from the send endpoint"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Fax identifier"},"status":{"type":"string","enum":["queued","dialing","sending","delivered","failed","cancelled","retrying"],"description":"Current fax status"},"provider":{"type":"string","description":"Provider used to send the fax"},"to":{"type":"string","description":"Recipient fax number"},"from":{"type":"string","description":"Sender fax number"},"createdAt":{"type":"string","description":"ISO timestamp when fax was created"},"updatedAt":{"type":"string","description":"ISO timestamp when status was last updated"},"deliveredAt":{"type":"string","description":"ISO timestamp when fax was delivered"},"errorMessage":{"type":"string","description":"Error message if fax failed"},"pageCount":{"type":"number","description":"Number of pages in the fax"},"duration":{"type":"number","description":"Call duration in seconds"},"cost":{"type":"number","description":"Cost of the fax"},"providerData":{"type":"object","additionalProperties":true,"description":"Provider-specific additional data"}},"required":["id","status","provider","to","from","createdAt","updatedAt"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/providers":{"get":{"operationId":"listFaxProviders","summary":"Fax Providers","tags":["Fax Services"],"description":"Get a list of available fax providers and their configuration status.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Provider name"},"configured":{"type":"boolean","description":"Whether the provider is properly configured"},"isDefault":{"type":"boolean","description":"Whether this is the default provider"}},"required":["name","configured","isDefault"]}}},"required":["providers"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/incoming/{id}/reprocess":{"post":{"operationId":"reprocessIncomingFax","summary":"Reprocess Incoming Fax","tags":["Incoming Fax"],"description":"Re-enqueue an incoming fax for QR code scanning/processing.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"id":{"type":"string"}},"required":["ok","id"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/v1/fax/incoming/requeue-salvage-errors":{"post":{"operationId":"requeueSalvageErrorFaxes","summary":"Requeue Salvage/Stuck Error Faxes","tags":["Incoming Fax"],"description":"Resets and requeues faxes that previously reached terminal error due to salvage/stuck max attempts.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"requeued":{"type":"number"}},"required":["ok","requeued"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]}}}}}}},"/v1/fax/incoming":{"get":{"operationId":"listIncomingFaxes","summary":"List Incoming Faxes","tags":["Incoming Fax"],"description":"Retrieve a list of recently received incoming faxes from the provider.","parameters":[{"schema":{"type":"string"},"in":"query","name":"provider","required":false,"description":"Provider override (default provider if omitted)"},{"schema":{"type":"string"},"in":"query","name":"since","required":false,"description":"ISO timestamp to filter faxes received after this time"},{"schema":{"type":"number","minimum":1,"maximum":200},"in":"query","name":"limit","required":false,"description":"Maximum number of faxes to return (provider max may apply)"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"faxes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string"},"receivedAt":{"type":"string"},"pageCount":{"type":"number"},"subject":{"type":"string"},"providerData":{"type":"object","additionalProperties":true}},"required":["id","provider","from","to","status","createdAt"]}}},"required":["faxes"]}}}}}}},"/v1/fax/incoming/{id}/content":{"get":{"operationId":"getIncomingFaxContent","summary":"Incoming Fax Content","tags":["Incoming Fax"],"description":"Retrieve the document content for an incoming fax as base64 encoded data.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Incoming fax ID"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"contentType":{"type":"string"},"filename":{"type":"string"},"contentBase64":{"type":"string","description":"Base64 encoded fax document"},"pageCount":{"type":"number"},"providerData":{"type":"object","additionalProperties":true}},"required":["id","provider","contentType","contentBase64"]}}}}}}},"/v1/fax/incoming/{id}":{"delete":{"operationId":"deleteIncomingFax","summary":"Delete Incoming Fax","tags":["Incoming Fax"],"description":"Delete an incoming fax from provider storage (if supported).","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deleted":{"type":"boolean"}},"required":["id","deleted"]}}}}}}},"/v1/fax/incoming/stored":{"get":{"operationId":"listStoredIncomingFaxes","summary":"Stored Incoming Faxes","tags":["Incoming Fax"],"description":"List incoming faxes persisted in local storage (backfilled + webhook).","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"stored":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string"},"receivedAt":{"type":"string"},"pageCount":{"type":"number"},"subject":{"type":"string"},"providerData":{"type":"object","additionalProperties":true}},"required":["id","provider","from","to","status","createdAt"]}}},"required":["stored"]}}}}}}},"/v1/fax/incoming/metrics":{"get":{"operationId":"incomingFaxMetrics","summary":"Incoming Fax Metrics","tags":["Incoming Fax"],"description":"Runtime metrics for incoming fax webhook processing (not persisted).","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalWebhookPosts":{"type":"number"},"validationHandshakes":{"type":"number"},"unsignedEvents":{"type":"number"},"unsignedEventsWithSecret":{"type":"number"},"unsignedEventsWhileSecretMissing":{"type":"number"},"unsignedEventsAccepted":{"type":"number"},"invalidSignature":{"type":"number"},"inboundFaxEvents":{"type":"number"},"inboundFaxProcessed":{"type":"number"},"inboundFaxStored":{"type":"number"},"inboundFaxContentPrefetchFailures":{"type":"number"},"lastInboundFaxStoredAt":{"type":"string"},"lastWebhookPostAt":{"type":"string"},"lastUnsignedEventAt":{"type":"string"},"lastInvalidSignatureAt":{"type":"string"}},"additionalProperties":false}}}}}}},"/v1/fax/incoming/debug":{"get":{"operationId":"incomingFaxProcessingDebug","summary":"Incoming Fax Processing Debug Snapshot","tags":["Incoming Fax"],"description":"Diagnostics snapshot of the incoming fax processing queue: counts, recent jobs, last reconciliation summary.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/fax":{"get":{"operationId":"searchFaxes","summary":"Search Faxes","tags":["Fax Management"],"description":"Search faxes with optional filtering and pagination.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string"},"in":"query","name":"id","required":false,"description":"Filter by exact document ID (_id)"},{"schema":{"type":"string"},"in":"query","name":"faxId","required":false,"description":"Filter by exact fax ID"},{"schema":{"type":"string","enum":["received","queued","processing","completed","error"]},"in":"query","name":"status","required":false,"description":"Filter by fax processing status"},{"schema":{"type":"string"},"in":"query","name":"brandId","required":false,"description":"Filter by exact brand ID"},{"schema":{"type":"string"},"in":"query","name":"idContains","required":false,"description":"Filter by document ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"faxIdContains","required":false,"description":"Filter by fax ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"brandIdContains","required":false,"description":"Filter by brand ID containing this value (case-insensitive)"},{"schema":{"type":"boolean"},"in":"query","name":"brandIdIsNull","required":false,"description":"Filter for faxes where brandId is null or not set"},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"since","required":false,"description":"Filter faxes received after this time"},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"until","required":false,"description":"Filter faxes received before this time"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"returned":{"type":"integer"}},"required":["page","pageSize","total","returned"]},"faxes":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"storagePath":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["received","queued","processing","completed","error"]},"attempts":{"type":"integer"},"lastError":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"scannedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer"},"codes":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"string","description":"Original scanned QR code value"},"data":{"type":"object","additionalProperties":true,"description":"Extracted data from parsing the raw QR string (orderCode, orderNumber, formId, url, etc.)"},"derived":{"type":"object","additionalProperties":true,"description":"Derived/resolved data from DB lookups (orderItemId, etc.)"}}}},"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true},"storagePath":{"type":"string"},"pageNums":{"type":"array","items":{"type":"integer"}},"createdAt":{"type":"string","format":"date-time"},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}}},"required":["meta","faxes"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}":{"get":{"operationId":"getFax","summary":"Get Fax","tags":["Fax Management"],"description":"Get fax metadata and processing status.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"fax":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"storagePath":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["received","queued","processing","completed","error"]},"attempts":{"type":"integer"},"lastError":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"scannedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer"},"codes":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"string","description":"Original scanned QR code value"},"data":{"type":"object","additionalProperties":true,"description":"Extracted data from parsing the raw QR string (orderCode, orderNumber, formId, url, etc.)"},"derived":{"type":"object","additionalProperties":true,"description":"Derived/resolved data from DB lookups (orderItemId, etc.)"}}}},"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true},"storagePath":{"type":"string"},"pageNums":{"type":"array","items":{"type":"integer"}},"createdAt":{"type":"string","format":"date-time"},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"required":["fax"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"patch":{"operationId":"updateFax","summary":"Update Fax","tags":["Fax Management"],"description":"Update fax metadata such as brandId, pageData, or splits.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer","minimum":1},"orderItemId":{"type":"string","nullable":true},"formId":{"type":"string","nullable":true}},"required":["pageNum"]}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"fax":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"storagePath":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["received","queued","processing","completed","error"]},"attempts":{"type":"integer"},"lastError":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"scannedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer"},"codes":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"string","description":"Original scanned QR code value"},"data":{"type":"object","additionalProperties":true,"description":"Extracted data from parsing the raw QR string (orderCode, orderNumber, formId, url, etc.)"},"derived":{"type":"object","additionalProperties":true,"description":"Derived/resolved data from DB lookups (orderItemId, etc.)"}}}},"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true},"storagePath":{"type":"string"},"pageNums":{"type":"array","items":{"type":"integer"}},"createdAt":{"type":"string","format":"date-time"},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"required":["success","message"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/content":{"get":{"operationId":"getFaxContent","summary":"Get Fax Content","tags":["Fax Management"],"description":"Get the base64-encoded PDF content of a fax.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"faxId":{"type":"string"},"contentType":{"type":"string"},"filename":{"type":"string"},"contentBase64":{"type":"string"}},"required":["faxId","contentType","contentBase64"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/metadata":{"get":{"operationId":"getFaxMetadata","summary":"Get Fax Metadata","tags":["Fax Management"],"description":"Get the storage metadata for a fax from local file storage.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"faxId":{"type":"string"},"metadata":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"status":{"type":"string"},"createdAt":{"type":"string"},"receivedAt":{"type":"string"},"pageCount":{"type":"number"},"subject":{"type":"string"},"contentType":{"type":"string"},"filename":{"type":"string"},"storedAt":{"type":"string"},"providerData":{"type":"object","additionalProperties":true}},"additionalProperties":true}},"required":["faxId","metadata"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/audit-log":{"get":{"operationId":"getFaxAuditLog","summary":"Get Fax Audit Log","tags":["Fax Management"],"description":"Get the audit log history for a fax.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"faxId":{"type":"string"},"auditLog":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"action":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"actorId":{"type":"string"},"actorType":{"type":"string","enum":["system","user"]},"metadata":{"type":"object","additionalProperties":true}}}}},"required":["faxId","auditLog"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/process":{"post":{"operationId":"processFax","summary":"Process Fax","tags":["Fax Management"],"description":"Trigger processing of a parsed fax.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"results":{"type":"object","properties":{"splitsProcessed":{"type":"integer"},"resultsUploaded":{"type":"integer"},"hl7Forwarded":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}}}}},"required":["success","message"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/scan":{"post":{"operationId":"scanFax","summary":"Scan Fax QR Codes","tags":["Fax Management"],"description":"Scan a fax and extract pageData. This updates the pageData field for each page.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"results":{"type":"object","properties":{"pageCount":{"type":"integer"},"codesFound":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}}}},"fax":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"storagePath":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["received","queued","processing","completed","error"]},"attempts":{"type":"integer"},"lastError":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"scannedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer"},"codes":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"string","description":"Original scanned QR code value"},"data":{"type":"object","additionalProperties":true,"description":"Extracted data from parsing the raw QR string (orderCode, orderNumber, formId, url, etc.)"},"derived":{"type":"object","additionalProperties":true,"description":"Derived/resolved data from DB lookups (orderItemId, etc.)"}}}},"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true},"storagePath":{"type":"string"},"pageNums":{"type":"array","items":{"type":"integer"}},"createdAt":{"type":"string","format":"date-time"},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"required":["success","message"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/{faxId}/split":{"post":{"operationId":"splitFax","summary":"Split Fax into PDFs","tags":["Fax Management"],"description":"Create PDF splits from the current pageData and updates the splits field. Old splits are deleted before regenerating.","parameters":[{"schema":{"type":"string"},"in":"path","name":"faxId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"results":{"type":"object","properties":{"splitCount":{"type":"integer"},"pageCount":{"type":"integer"},"errors":{"type":"array","items":{"type":"string"}}}},"fax":{"type":"object","properties":{"_id":{"type":"string"},"faxId":{"type":"string"},"storagePath":{"type":"string"},"receivedAt":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["received","queued","processing","completed","error"]},"attempts":{"type":"integer"},"lastError":{"type":"string"},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"type":"string","format":"date-time"},"scannedAt":{"type":"string","format":"date-time"},"brandId":{"type":"string","nullable":true},"pageData":{"type":"array","items":{"type":"object","properties":{"pageNum":{"type":"integer"},"codes":{"type":"array","items":{"type":"object","properties":{"raw":{"type":"string","description":"Original scanned QR code value"},"data":{"type":"object","additionalProperties":true,"description":"Extracted data from parsing the raw QR string (orderCode, orderNumber, formId, url, etc.)"},"derived":{"type":"object","additionalProperties":true,"description":"Derived/resolved data from DB lookups (orderItemId, etc.)"}}}},"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true}}}},"splits":{"type":"array","items":{"type":"object","properties":{"formId":{"type":"string","nullable":true},"orderItemId":{"type":"string","nullable":true},"storagePath":{"type":"string"},"pageNums":{"type":"array","items":{"type":"integer"}},"createdAt":{"type":"string","format":"date-time"},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"meta":{"type":"object","properties":{"pageCount":{"type":"integer"},"fileSize":{"type":"integer"}}}}}},"required":["success","message"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/fax/incoming/webhook/ringcentral":{"post":{"responses":{"200":{"description":"Default Response"}}}},"/v1/employers":{"post":{"operationId":"createEmployer","summary":"Create Employer","tags":["Employers"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":200},"address":{"type":"object","properties":{"street1":{"type":"string"},"street2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zipCode":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","state","zipCode"]},"billingAddress":{"type":"object","additionalProperties":true},"phones":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string"},"type":{"type":"string"},"primary":{"type":"boolean"}},"required":["number"]}},"website":{"type":"string"},"email":{"type":"string","format":"email","maxLength":200},"onsiteClinic":{"type":"boolean"},"demo":{"type":"boolean"},"employeeConsent":{"type":"boolean"},"checkr":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id"]},"metadata":{"type":"object","additionalProperties":true}},"required":["name","address","phones","email"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"address":{"type":"object","additionalProperties":true},"phones":{"type":"array","items":{"type":"object","additionalProperties":true}},"email":{"type":"string"},"website":{"type":"string"},"onsiteClinic":{"type":"boolean"},"demo":{"type":"boolean"},"employeeConsent":{"type":"boolean"},"createdAt":{"type":"string"},"createdBy":{"type":"string"}},"required":["_id","name","address","phones","email"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/employers/{employerId}":{"get":{"operationId":"getEmployer","summary":"Get Employer","tags":["Employers"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/v1/employers/list":{"get":{"operationId":"getEmployerListForCurrentUser","summary":"Get Employers for Current User","tags":["Employers"],"parameters":[{"schema":{"type":"string"},"in":"header","name":"authorization","required":true},{"schema":{"type":"string"},"in":"header","name":"login-token","required":true},{"schema":{"type":"string"},"in":"header","name":"user-id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/v1/orders/{orderId}/results":{"get":{"summary":"Get order results","tags":["Orders"],"description":"Retrieve results for an order. Supports filtering by serviceId, status, date window, and pagination.","parameters":[{"schema":{"type":"string"},"in":"query","name":"serviceId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"since","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"until","required":false},{"schema":{"type":"string"},"in":"path","name":"orderId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"orderId":{"type":"string"},"orderNumber":{"type":"string"},"employeeId":{"type":"string"},"providerId":{"type":"string"},"totalServices":{"type":"number"},"page":{"type":"number"},"pageSize":{"type":"number"},"returned":{"type":"number"}},"required":["orderId","totalServices","page","pageSize","returned"]},"services":{"type":"array","items":{"type":"object","properties":{"serviceId":{"type":"string"},"status":{"type":"string"},"result":{"type":"string"},"altTxt":{"type":"string"},"message":{"type":"string"},"resultsPosted":{"type":"string","format":"date-time"},"drawn_datetime":{"type":"string","format":"date-time"},"completed_datetime":{"type":"string","format":"date-time"},"fileIds":{"type":"array","items":{"type":"string"}},"contacts":{"type":"array","items":{"type":"string"}}},"required":["serviceId","status"]}}},"required":["meta","services"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orders/{orderId}/cancel":{"post":{"summary":"Cancel an order item","tags":["Orders"],"description":"Cancel a specific order by its orderId.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"Order's orderId to cancel"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"}},"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orders":{"post":{"summary":"Create a new order","tags":["Orders"],"description":"Create orders for consumers (self-pay or employer-sponsored), employers, or bulk orders. Consolidates functionality from legacy Order.createOrder and Order.SendOrder methods.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","maxLength":200},"employeeId":{"type":"string","maxLength":200},"employerId":{"type":"string","maxLength":200},"services":{"type":"array","items":{"type":"object","required":["_id","quantity"],"properties":{"_id":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","minimum":1,"maximum":100},"autoAccept":{"type":"boolean"}},"additionalProperties":false},"minItems":1,"maxItems":50},"providerId":{"type":"string","maxLength":200},"person":{"type":"object","required":["firstName","lastName","dob","street","city","state","zipcode","phone","email"],"properties":{"firstName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"dob":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"street":{"type":"string","minLength":1,"maxLength":200},"street2":{"type":"string","maxLength":200},"city":{"type":"string","minLength":1,"maxLength":100},"state":{"type":"string","minLength":2,"maxLength":50},"county":{"type":"string","maxLength":100},"country":{"type":"string","maxLength":100},"zipcode":{"type":"string","pattern":"^\\d{5}(-\\d{4})?$","description":"US ZIP code in 12345 or 12345-6789 format"},"phone":{"type":"string","pattern":"^[+]?[0-9\\s\\-\\(\\)]+$","minLength":10,"maxLength":20},"email":{"type":"string","maxLength":200}},"additionalProperties":false},"paymentMethod":{"type":"string","enum":["self-pay","employer-sponsored"]},"tokenId":{"type":"string","maxLength":200},"reCaptchaToken":{"type":"string","maxLength":2000},"quantities":{"type":"object","additionalProperties":{"type":"integer","minimum":1,"maximum":100}},"servicesIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50},"providersIds":{"type":"array","items":{"type":"object","required":["providerId"],"properties":{"serviceId":{"type":"string","minLength":1,"maxLength":200},"providerId":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false},"maxItems":50},"dueDates":{"type":"array","items":{"type":"string","format":"date-time"},"maxItems":50},"dueDate":{"type":"string","format":"date-time"},"brandId":{"type":"string","maxLength":200},"providerCreated":{"type":"boolean"},"employeeIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":1000},"priority":{"type":"string","enum":["normal","high"],"default":"normal","description":"Order priority level"},"metadata":{"type":"object","additionalProperties":true,"description":"Optional arbitrary metadata (<=10KB when JSON stringified)"}},"additionalProperties":false,"anyOf":[{"required":["person","services","providerId","paymentMethod"],"properties":{"reCaptchaToken":{"type":"string"}}},{"required":["employeeId","employerId","services"]},{"required":["employeeId","employerId","servicesIds","providersIds"]},{"required":["employeeIds","employerId","servicesIds","providersIds"]}]}}}},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"oneOf":[{"type":"object","required":["success","orderId","orderNumber"],"properties":{"success":{"type":"boolean","enum":[true]},"orderId":{"type":"string"},"orderNumber":{"type":"string"},"selfPay":{"type":"boolean"},"hostedInvoiceUrl":{"type":"string","format":"uri"},"message":{"type":"string"},"unavailableServices":{"type":"array","items":{"type":"object","required":["serviceId","reason"],"properties":{"serviceId":{"type":"string"},"serviceName":{"type":"string"},"reason":{"type":"string"}},"additionalProperties":false}},"partialSuccess":{"type":"boolean"}},"additionalProperties":false},{"type":"object","required":["success","status","orderResults"],"properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["split"]},"message":{"type":"string"},"orderResults":{"type":"array","minItems":2,"items":{"type":"object","required":["orderId","orderNumber","providerId"],"properties":{"orderId":{"type":"string"},"orderNumber":{"type":"string"},"providerId":{"type":"string"}},"additionalProperties":false}},"unavailableServices":{"type":"array","items":{"type":"object","required":["serviceId","reason"],"properties":{"serviceId":{"type":"string"},"serviceName":{"type":"string"},"reason":{"type":"string"}},"additionalProperties":false}},"partialSuccess":{"type":"boolean"}},"additionalProperties":false}]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orders/{orderId}":{"get":{"summary":"Get order details","tags":["Orders"],"description":"Retrieve details for a specific order","parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string"},"orderNumber":{"type":"string"},"status":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}},"post":{"summary":"Update an existing order","tags":["Orders"],"description":"Update order details and associated order items. Allows updating order status, metadata, and modifying order item services.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["order_sent","order_accepted","order_refused","employee_confirmed","order_fulfilled","order_complete"]},"metadata":{"type":"object","additionalProperties":true,"description":"Arbitrary metadata to update on the order (non-indexed passthrough, <=10KB when JSON stringified)"},"services":{"type":"array","items":{"type":"object","required":["serviceId"],"properties":{"serviceId":{"type":"string","minLength":1,"maxLength":200},"status":{"type":"string","enum":["pending","in_progress","completed","cancelled","rejected"]},"results":{"type":"object","additionalProperties":true},"dueDate":{"type":"string","format":"date-time"}}},"maxItems":50}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"The ID of the order to update"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["success","message","orderId","orderNumber"],"properties":{"success":{"type":"boolean","enum":[true]},"message":{"type":"string"},"orderId":{"type":"string"},"orderNumber":{"type":"string"},"updatedFields":{"type":"array","items":{"type":"string"}}},"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orders/{orderId}/status":{"put":{"summary":"Update order status","tags":["Orders"],"description":"Update the status of an existing order","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["order_sent","order_accepted","order_refused","employee_confirmed","order_fulfilled","order_complete"]},"message":{"type":"string"}}}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}}}}},"/v1/orders/send":{"post":{"operationId":"sendOrderForEmployee","summary":"Send Order for Employee","tags":["Orders"],"description":"Send an order for a specific employee. Requires API key, login token, and user ID. This endpoint specifically handles employer-to-employee order sending.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employeeId","employerId","servicesIds","providersIds"],"properties":{"employeeId":{"type":"string","description":"Employee ID to send order to"},"employerId":{"type":"string","description":"Employer ID sending the order"},"servicesIds":{"type":"array","description":"Array of service IDs to include in the order","items":{"type":"string"}},"providersIds":{"type":"array","description":"Array mapping each service (by index) to a provider; serviceId optional","items":{"type":"object","required":["providerId"],"properties":{"serviceId":{"type":"string"},"providerId":{"type":"string"}}}},"quantities":{"type":"object","description":"Service ID to quantity mapping","additionalProperties":{"type":"integer","minimum":1,"maximum":100}},"providerId":{"type":"string","description":"Single provider ID (shortcut when all services map to one provider)"},"brandId":{"type":"string","description":"Brand ID for branded orders"},"dueDate":{"type":"string","description":"Due date for the order (date or date-time ISO string)"},"dueDates":{"type":"array","description":"Array of due dates per service","items":{"type":"string"}},"providerCreated":{"type":"boolean","description":"Whether this order is being created by a provider (affects permission checking)"},"metadata":{"type":"object","additionalProperties":true,"description":"Optional arbitrary metadata to store on the order (non-indexed passthrough, <=10KB when JSON stringified)"},"priority":{"type":"string","enum":["normal","high"],"default":"normal","description":"Order priority level"}}}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"header","name":"authorization","required":true,"description":"Bearer <API_KEY>"},{"schema":{"type":"string"},"in":"header","name":"login-token","required":true,"description":"User login token"},{"schema":{"type":"string"},"in":"header","name":"user-id","required":true,"description":"User ID"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Order sent successfully (single or split)","content":{"application/json":{"schema":{"description":"Order sent successfully (single or split)","oneOf":[{"type":"object","required":["success","orderId","orderNumber"],"properties":{"success":{"type":"boolean","enum":[true]},"orderId":{"type":"string"},"orderNumber":{"type":"string"},"message":{"type":"string"},"unavailableServices":{"type":"array","description":"Services that could not be included in the order","items":{"type":"object","required":["serviceId","reason"],"properties":{"serviceId":{"type":"string"},"serviceName":{"type":"string"},"reason":{"type":"string","description":"Why the service was unavailable"}}}},"partialSuccess":{"type":"boolean","description":"True when some services were unavailable but order was still created"}},"additionalProperties":false},{"type":"object","required":["success","status","orderResults"],"properties":{"success":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["split"]},"message":{"type":"string"},"orderResults":{"type":"array","minItems":1,"items":{"type":"object","required":["orderId","orderNumber","providerId"],"properties":{"orderId":{"type":"string"},"orderNumber":{"type":"string"},"providerId":{"type":"string"}},"additionalProperties":false}},"unavailableServices":{"type":"array","description":"Services that could not be included in any order","items":{"type":"object","required":["serviceId","reason"],"properties":{"serviceId":{"type":"string"},"serviceName":{"type":"string"},"reason":{"type":"string","description":"Why the service was unavailable"}}}},"partialSuccess":{"type":"boolean","description":"True when some services were unavailable but orders were still created"}},"additionalProperties":false}]}}}},"400":{"description":"Bad request (validation error)","content":{"application/json":{"schema":{"type":"object","description":"Bad request (validation error)","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error (missing/invalid API key or login credentials)","content":{"application/json":{"schema":{"type":"object","description":"Authentication error (missing/invalid API key or login credentials)","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Access denied (authenticated, but no user context or insufficient permissions)","content":{"application/json":{"schema":{"type":"object","description":"Access denied (authenticated, but no user context or insufficient permissions)","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/orders/{orderId}/upload-results":{"post":{"summary":"Upload results for an order","tags":["Orders"],"description":"Upload test results for a specific order item. Supports both existing fileIds and base64 encoded files. Requires order access code and employee verification.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["orderAccessCode","serviceId","captchaToken"],"properties":{"orderAccessCode":{"type":"string","minLength":1,"maxLength":50},"serviceId":{"type":"string","minLength":1,"maxLength":200},"captchaToken":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1,"maxLength":100},"dob":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","description":"Date of birth in YYYY-MM-DD format"},"fileIds":{"type":"array","items":{"type":"string","minLength":1},"minItems":0},"files":{"type":"array","items":{"type":"object","required":["name","type","base64"],"properties":{"name":{"type":"string","minLength":1,"maxLength":255},"type":{"type":"string","minLength":1,"maxLength":100},"base64":{"type":"string","minLength":1}}},"minItems":0}},"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orders/{orderId}/schedule-appointment":{"post":{"summary":"Schedule an appointment for an order","tags":["Orders"],"description":"Schedule an appointment or walk-in for an existing order. Sends HL7 SIU^S12 message for appointment booking.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["appointment"],"properties":{"appointment":{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["appointment","walkin"]},"dateTime":{"type":"string","format":"date-time","description":"Required for appointment type"},"date":{"type":"string","description":"Required for appointment type"},"time":{"type":"string","description":"Required for appointment type"},"notes":{"type":"string","maxLength":1000,"description":"Optional for walkin type"}},"additionalProperties":false,"oneOf":[{"properties":{"type":{"enum":["appointment"]}},"required":["dateTime","date","time"]},{"properties":{"type":{"enum":["walkin"]}}}]},"orderAccessCode":{"type":"string","description":"Order access code for authorization"},"providerId":{"type":"string","description":"Provider ID for authorization"}},"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"The order ID"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","required":["success","message"],"properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/orderItems":{"get":{"operationId":"searchOrderItems","summary":"Search Order Items","tags":["Orders"],"description":"Search order items with optional filtering and pagination. Results are sorted by creation date descending.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string"},"in":"query","name":"id","required":false,"description":"Filter by exact document ID (_id)"},{"schema":{"type":"string"},"in":"query","name":"orderNumber","required":false,"description":"Filter by exact order number"},{"schema":{"type":"string"},"in":"query","name":"orderId","required":false,"description":"Filter by exact order ID"},{"schema":{"type":"string"},"in":"query","name":"employeeId","required":false,"description":"Filter by exact employee ID"},{"schema":{"type":"string"},"in":"query","name":"employerId","required":false,"description":"Filter by exact employer ID"},{"schema":{"type":"string"},"in":"query","name":"providerId","required":false,"description":"Filter by exact provider ID"},{"schema":{"type":"string"},"in":"query","name":"orderAccessCode","required":false,"description":"Filter by exact order access code"},{"schema":{"type":"string"},"in":"query","name":"serviceId","required":false,"description":"Filter by exact service ID within services array"},{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by service status within orderItems"},{"schema":{"type":"string"},"in":"query","name":"idContains","required":false,"description":"Filter by document ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"orderNumberContains","required":false,"description":"Filter by order number containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"orderIdContains","required":false,"description":"Filter by order ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"employeeIdContains","required":false,"description":"Filter by employee ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"orderAccessCodeContains","required":false,"description":"Filter by order access code containing this value (case-insensitive)"},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"since","required":false,"description":"Filter orderItems created after this time"},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"until","required":false,"description":"Filter orderItems created before this time"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"returned":{"type":"integer"}},"required":["page","pageSize","total","returned"]},"orderItems":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"orderId":{"type":"string"},"orderNumber":{"type":"string"},"employerId":{"type":"string"},"employeeId":{"type":"string"},"providerId":{"type":"string"},"orderAccessCode":{"type":"string"},"priority":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"services":{"type":"array","items":{"type":"object","properties":{"serviceId":{"type":"string"},"price":{"type":"number"},"quantity":{"type":"integer"},"lastEdit":{"type":"string","format":"date-time"},"status":{"type":"string"},"dueDate":{"type":"string","format":"date-time"},"selfReport":{"type":"boolean"},"results":{"type":"object","additionalProperties":true}},"additionalProperties":true}},"demo":{"type":"boolean"}},"additionalProperties":true}}},"required":["meta","orderItems"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/employees":{"post":{"operationId":"createEmployee","summary":"Create Employee","tags":["Employees"],"description":"Create a new employee in the system.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":254},"dob":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"title":{"type":"string","maxLength":200},"activeAccount":{"type":"string","enum":["Active","Inactive"]},"blurb":{"type":"string","maxLength":1000},"address":{"type":"object","properties":{"street1":{"type":"string","minLength":1},"street2":{"type":"string"},"city":{"type":"string","minLength":1},"state":{"type":"string","minLength":1},"postalCode":{"type":"string","minLength":1},"county":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","state","postalCode"],"additionalProperties":false},"phone":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string","minLength":1},"type":{"type":"string","enum":["Cell","Home","Work","Other"]}},"required":["number","type"],"additionalProperties":false},"maxItems":5},"employer_id":{"type":"string"},"departments":{"type":"array","items":{"type":"string"},"maxItems":10},"extendedFields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"value":{"type":"string","minLength":1}},"required":["name","value"],"additionalProperties":false},"maxItems":20}},"required":["firstName","lastName","email"],"additionalProperties":false}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Employee created successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee created successfully","properties":{"success":{"type":"boolean"},"employeeId":{"type":"string","description":"ID of the created employee"},"message":{"type":"string"}},"required":["success","employeeId","message"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","description":"Validation error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"put":{"operationId":"updateEmployee","summary":"Update Employee","tags":["Employees"],"description":"Update an existing employee in the system.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","minLength":1},"firstName":{"type":"string","minLength":1,"maxLength":100},"lastName":{"type":"string","minLength":1,"maxLength":100},"email":{"type":"string","format":"email","maxLength":254},"dob":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"title":{"type":"string","maxLength":200},"activeAccount":{"type":"string","enum":["Active","Inactive"]},"blurb":{"type":"string","maxLength":1000},"address":{"type":"object","properties":{"street1":{"type":"string","minLength":1},"street2":{"type":"string"},"city":{"type":"string","minLength":1},"state":{"type":"string","minLength":1},"postalCode":{"type":"string","minLength":1},"county":{"type":"string"},"country":{"type":"string"}},"required":["street1","city","state","postalCode"],"additionalProperties":false},"phone":{"type":"array","items":{"type":"object","properties":{"number":{"type":"string","minLength":1},"type":{"type":"string","enum":["Cell","Home","Work","Other"]}},"required":["number","type"],"additionalProperties":false},"maxItems":5},"employer_id":{"type":"string"},"departments":{"type":"array","items":{"type":"string"},"maxItems":10},"extendedFields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"value":{"type":"string","minLength":1}},"required":["name","value"],"additionalProperties":false},"maxItems":20}},"required":["_id"],"additionalProperties":false}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Employee updated successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee updated successfully","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","description":"Validation error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employee not found","content":{"application/json":{"schema":{"type":"object","description":"Employee not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"get":{"operationId":"listEmployees","summary":"List Employees","tags":["Employees"],"description":"List all employees for a given employer with pagination.","parameters":[{"schema":{"type":"string"},"in":"query","name":"employerId","required":true,"description":"ID of the employer to list employees for"},{"schema":{"type":"string","pattern":"^[0-9]+$"},"in":"query","name":"limit","required":false,"description":"Maximum number of employees to return (default: 50)"},{"schema":{"type":"string","pattern":"^[0-9]+$"},"in":"query","name":"offset","required":false,"description":"Number of employees to skip (default: 0)"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Employees retrieved successfully","content":{"application/json":{"schema":{"type":"object","description":"Employees retrieved successfully","properties":{"success":{"type":"boolean"},"employees":{"type":"array","description":"List of employees","items":{"type":"object","description":"Employee details","properties":{"_id":{"type":"string","description":"Unique identifier"},"firstName":{"type":"string","description":"First name"},"lastName":{"type":"string","description":"Last name"},"email":{"type":"string","description":"Email address"},"dob":{"type":"string","description":"Date of birth"},"title":{"type":"string","description":"Job title"},"activeAccount":{"type":"string","enum":["Active","Inactive"],"description":"Account status"},"blurb":{"type":"string","description":"Brief description or bio"},"address":{"type":"object","description":"Employee address","properties":{"street1":{"type":"string","description":"Street address line 1"},"street2":{"type":"string","description":"Street address line 2"},"city":{"type":"string","description":"City"},"state":{"type":"string","description":"State"},"postalCode":{"type":"string","description":"Postal code"},"county":{"type":"string","description":"County"},"country":{"type":"string","description":"Country"}},"required":["street1","city","state","postalCode"]},"phone":{"type":"array","description":"Contact phone numbers","items":{"type":"object","properties":{"number":{"type":"string","description":"Phone number"},"type":{"type":"string","enum":["Cell","Home","Work","Other"],"description":"Type of phone number"}},"required":["number","type"]}},"employer_id":{"type":"string","description":"ID of associated employer"},"departments":{"type":"array","items":{"type":"string"},"description":"List of department names"},"extendedFields":{"type":"array","description":"Additional custom fields","items":{"type":"object","properties":{"name":{"type":"string","description":"Field name"},"value":{"type":"string","description":"Field value"}},"required":["name","value"]}},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"createdBy":{"type":"string","description":"ID of user who created the employee"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"},"updatedBy":{"type":"string","description":"ID of user who last updated the employee"}},"required":["_id","firstName","lastName","email","employer_id"]}},"total":{"type":"number","description":"Total number of employees returned"},"message":{"type":"string"}},"required":["success","employees","total","message"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","description":"Validation error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employer not found","content":{"application/json":{"schema":{"type":"object","description":"Employer not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/employees/{employeeId}":{"get":{"operationId":"getEmployee","summary":"Get Employee","tags":["Employees"],"description":"Retrieve an employee by their unique ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"employeeId","required":true,"description":"Unique identifier of the employee"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Employee found successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee found successfully","properties":{"success":{"type":"boolean"},"employee":{"type":"object","description":"Employee details","properties":{"_id":{"type":"string","description":"Unique identifier"},"firstName":{"type":"string","description":"First name"},"lastName":{"type":"string","description":"Last name"},"email":{"type":"string","description":"Email address"},"dob":{"type":"string","description":"Date of birth"},"title":{"type":"string","description":"Job title"},"activeAccount":{"type":"string","enum":["Active","Inactive"],"description":"Account status"},"blurb":{"type":"string","description":"Brief description or bio"},"address":{"type":"object","description":"Employee address","properties":{"street1":{"type":"string","description":"Street address line 1"},"street2":{"type":"string","description":"Street address line 2"},"city":{"type":"string","description":"City"},"state":{"type":"string","description":"State"},"postalCode":{"type":"string","description":"Postal code"},"county":{"type":"string","description":"County"},"country":{"type":"string","description":"Country"}},"required":["street1","city","state","postalCode"]},"phone":{"type":"array","description":"Contact phone numbers","items":{"type":"object","properties":{"number":{"type":"string","description":"Phone number"},"type":{"type":"string","enum":["Cell","Home","Work","Other"],"description":"Type of phone number"}},"required":["number","type"]}},"employer_id":{"type":"string","description":"ID of associated employer"},"departments":{"type":"array","items":{"type":"string"},"description":"List of department names"},"extendedFields":{"type":"array","description":"Additional custom fields","items":{"type":"object","properties":{"name":{"type":"string","description":"Field name"},"value":{"type":"string","description":"Field value"}},"required":["name","value"]}},"createdAt":{"type":"string","format":"date-time","description":"Creation timestamp"},"createdBy":{"type":"string","description":"ID of user who created the employee"},"updatedAt":{"type":"string","format":"date-time","description":"Last update timestamp"},"updatedBy":{"type":"string","description":"ID of user who last updated the employee"}},"required":["_id","firstName","lastName","email","employer_id"]},"message":{"type":"string"}},"required":["success","employee","message"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employee not found","content":{"application/json":{"schema":{"type":"object","description":"Employee not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"delete":{"operationId":"deleteEmployee","summary":"Delete Employee","tags":["Employees"],"description":"Delete an employee from the system. Cannot delete employees with existing orders.","parameters":[{"schema":{"type":"string"},"in":"path","name":"employeeId","required":true,"description":"Unique identifier of the employee to delete"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Employee deleted successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee deleted successfully","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Validation error or employee has existing orders","content":{"application/json":{"schema":{"type":"object","description":"Validation error or employee has existing orders","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employee not found","content":{"application/json":{"schema":{"type":"object","description":"Employee not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/employees/link-user":{"post":{"operationId":"linkEmployeeUser","summary":"Link Employee to User","tags":["Employees"],"description":"Link an employee to a user account with specified roles","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string","minLength":1},"userId":{"type":"string","minLength":1},"role":{"type":"array","items":{"type":"string"},"default":["user"]}},"required":["employeeId","userId"],"additionalProperties":false}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Employee linked successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee linked successfully","properties":{"success":{"type":"boolean"},"linkId":{"type":"string","description":"ID of the created link"},"message":{"type":"string"}},"required":["success","linkId","message"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","description":"Validation error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employee or user not found","content":{"application/json":{"schema":{"type":"object","description":"Employee or user not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/employees/unlink-user":{"delete":{"operationId":"unlinkEmployeeUser","summary":"Unlink Employee from User","tags":["Employees"],"description":"Remove the link between an employee and a user account","parameters":[{"schema":{"type":"string"},"in":"query","name":"employeeId","required":true,"description":"ID of the employee to unlink"},{"schema":{"type":"string"},"in":"query","name":"userId","required":true,"description":"ID of the user to unlink from"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Employee unlinked successfully","content":{"application/json":{"schema":{"type":"object","description":"Employee unlinked successfully","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","description":"Validation error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Authentication error","content":{"application/json":{"schema":{"type":"object","description":"Authentication error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Employee, user, or link not found","content":{"application/json":{"schema":{"type":"object","description":"Employee, user, or link not found","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","description":"Server error","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7":{"post":{"operationId":"processHL7Message","summary":"Process HL7 Message","tags":["HL7"],"description":"Process incoming HL7 messages from EHR systems. Accepts JSON with \"message\" field, raw text/plain HL7 content, or form-encoded data.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"oneOf":[{"type":"string"},{"type":"object"}],"description":"HL7 message content - the primary way to send HL7 data"},"f":{"type":"string","description":"Form field (legacy support)"},"interface":{"type":"string","description":"Interface identifier (legacy support)"},"login_user":{"type":"string","description":"Login user (legacy support)"},"login_passwd":{"type":"string","description":"Login password (legacy support)"},"message_b64":{"type":"string","description":"Base64 encoded HL7 message (legacy support)"}},"additionalProperties":true,"description":"HL7 message data. For JSON: use \"message\" field. For text/plain: send raw HL7. For form-encoded: include message field."}},"text/plain":{"schema":{"type":"object","properties":{"message":{"oneOf":[{"type":"string"},{"type":"object"}],"description":"HL7 message content - the primary way to send HL7 data"},"f":{"type":"string","description":"Form field (legacy support)"},"interface":{"type":"string","description":"Interface identifier (legacy support)"},"login_user":{"type":"string","description":"Login user (legacy support)"},"login_passwd":{"type":"string","description":"Login password (legacy support)"},"message_b64":{"type":"string","description":"Base64 encoded HL7 message (legacy support)"}},"additionalProperties":true,"description":"HL7 message data. For JSON: use \"message\" field. For text/plain: send raw HL7. For form-encoded: include message field."}},"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"message":{"oneOf":[{"type":"string"},{"type":"object"}],"description":"HL7 message content - the primary way to send HL7 data"},"f":{"type":"string","description":"Form field (legacy support)"},"interface":{"type":"string","description":"Interface identifier (legacy support)"},"login_user":{"type":"string","description":"Login user (legacy support)"},"login_passwd":{"type":"string","description":"Login password (legacy support)"},"message_b64":{"type":"string","description":"Base64 encoded HL7 message (legacy support)"}},"additionalProperties":true,"description":"HL7 message data. For JSON: use \"message\" field. For text/plain: send raw HL7. For form-encoded: include message field."}}},"description":"HL7 message data. For JSON: use \"message\" field. For text/plain: send raw HL7. For form-encoded: include message field."},"responses":{"200":{"description":"HL7 ACK message","content":{"application/json":{"schema":{"type":"string","description":"HL7 ACK message"}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/hl7/results":{"post":{"operationId":"sendHL7Results","summary":"Send HL7 Results","tags":["HL7"],"description":"Send lab results or documents via HL7","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string","description":"Employee ID to send results for"},"file":{"type":"object","properties":{"name":{"type":"string","description":"File name"},"type":{"type":"string","description":"MIME type of the file"},"base64":{"type":"string","description":"Base64 encoded file content"}},"required":["name","type","base64"],"description":"File containing the results"}},"required":["employeeId","file"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Result of HL7 message send","content":{"application/json":{"schema":{"type":"string","description":"Result of HL7 message send"}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/hl7/replay/{logId}":{"post":{"operationId":"replayHL7Message","summary":"Replay HL7 Message","tags":["HL7"],"description":"Replay a previously sent outbound HL7 message by its log ID. The exact same message will be re-sent to the specified destination. If no destination is provided, the original destination will be used (credentials required).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"destination":{"type":"object","description":"Destination configuration for sending the message. If not provided, uses the original destination from the log.","properties":{"url":{"type":"string","description":"Hostname (with optional path) or full URL for the HL7 endpoint (e.g. https://emr.example.com/webchart.cgi)","minLength":4},"protocol":{"type":"string","enum":["http","https"],"description":"Transport protocol (default: https)"},"port":{"type":"number","description":"Explicit port override"},"username":{"type":"string","description":"Basic/form auth username"},"password":{"type":"string","description":"Basic/form auth password"},"timeout":{"type":"number","description":"Request timeout in ms (default: 30000)"},"retryAttempts":{"type":"number","description":"Max retry attempts (default: 3)"},"retryDelay":{"type":"number","description":"Base retry delay in seconds (default: 1)"}}},"interfaceName":{"type":"string","description":"Interface name to use in the request (default: bluehiveadt)"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"logId","required":true,"description":"The _id of the HL7Log entry to replay"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Result of the replayed HL7 message send","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"messageId":{"type":"string"},"acknowledgment":{"type":"string"},"retryCount":{"type":"number"},"duration":{"type":"number"},"originalLogId":{"type":"string"},"newLogTimestamp":{"type":"string"}},"description":"Result of the replayed HL7 message send"}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}},"/v1/employers/{employerId}/service-bundles":{"post":{"operationId":"createEmployerServiceBundle","summary":"Create Service Bundle","tags":["Employers","Service Bundles"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","maxLength":200},"bundleName":{"type":"string","minLength":1,"maxLength":100},"serviceIds":{"type":"array","items":{"type":"string"},"uniqueItems":true},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"}},"required":["bundleName","serviceIds"]}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"employerId":{"type":"string"},"bundleName":{"type":"string"},"serviceIds":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"},"integrationData":{"type":"object","properties":{"enterprise-health":{"type":"object","properties":{"addOnServices":{"type":"boolean"}}}}},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"externallyManaged":{"type":"boolean","description":"Indicates if this bundle originated from a third-party integration. Externally managed bundles cannot be edited or deleted in BlueHive."},"integration":{"type":"string","nullable":true,"description":"Name of the third-party integration that manages this bundle (e.g., \"Enterprise Health\"). Null if bundle was created in BlueHive."}},"required":["_id","employerId","bundleName","serviceIds"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"get":{"operationId":"listEmployerServiceBundles","summary":"List Service Bundles","tags":["Employers","Service Bundles"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"employerId":{"type":"string"},"bundleName":{"type":"string"},"serviceIds":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"},"integrationData":{"type":"object","properties":{"enterprise-health":{"type":"object","properties":{"addOnServices":{"type":"boolean"}}}}},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"externallyManaged":{"type":"boolean","description":"Indicates if this bundle originated from a third-party integration. Externally managed bundles cannot be edited or deleted in BlueHive."},"integration":{"type":"string","nullable":true,"description":"Name of the third-party integration that manages this bundle (e.g., \"Enterprise Health\"). Null if bundle was created in BlueHive."}},"required":["_id","employerId","bundleName","serviceIds"]}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/v1/employers/{employerId}/service-bundles/{id}":{"get":{"operationId":"getEmployerServiceBundle","summary":"Get Service Bundle","tags":["Employers","Service Bundles"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"employerId":{"type":"string"},"bundleName":{"type":"string"},"serviceIds":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"},"integrationData":{"type":"object","properties":{"enterprise-health":{"type":"object","properties":{"addOnServices":{"type":"boolean"}}}}},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"externallyManaged":{"type":"boolean","description":"Indicates if this bundle originated from a third-party integration. Externally managed bundles cannot be edited or deleted in BlueHive."},"integration":{"type":"string","nullable":true,"description":"Name of the third-party integration that manages this bundle (e.g., \"Enterprise Health\"). Null if bundle was created in BlueHive."}},"required":["_id","employerId","bundleName","serviceIds"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"put":{"operationId":"updateEmployerServiceBundle","summary":"Update Service Bundle","tags":["Employers","Service Bundles"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string","maxLength":200},"bundleName":{"type":"string","minLength":1,"maxLength":100},"serviceIds":{"type":"array","items":{"type":"string"},"uniqueItems":true},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"}},"required":["bundleName","serviceIds"]}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"employerId":{"type":"string"},"bundleName":{"type":"string"},"serviceIds":{"type":"array","items":{"type":"string"}},"roles":{"type":"array","items":{"type":"string"},"nullable":true},"limit":{"type":"number"},"occurrence":{"type":"string"},"recurring":{"type":"boolean"},"startDate":{"type":"string"},"integrationData":{"type":"object","properties":{"enterprise-health":{"type":"object","properties":{"addOnServices":{"type":"boolean"}}}}},"createdAt":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"externallyManaged":{"type":"boolean","description":"Indicates if this bundle originated from a third-party integration. Externally managed bundles cannot be edited or deleted in BlueHive."},"integration":{"type":"string","nullable":true,"description":"Name of the third-party integration that manages this bundle (e.g., \"Enterprise Health\"). Null if bundle was created in BlueHive."}},"required":["_id","employerId","bundleName","serviceIds"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}},"delete":{"operationId":"deleteEmployerServiceBundle","summary":"Delete Service Bundle","tags":["Employers","Service Bundles"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"employerId","required":true},{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"204":{"description":"Default Response"},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","summary":"List brand integrations","tags":["Integrations"],"description":"Returns the current brand integrations object keyed by integration name (empty object if none). Brand resolved via x-brand-id header.","parameters":[{"schema":{"type":"string","minLength":1},"in":"header","name":"x-brand-id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"integrations":{"type":"object","additionalProperties":{"type":"object","properties":{"displayName":{"type":"string"},"active":{"type":"boolean"},"config":{"type":"object","additionalProperties":true}},"required":["displayName","active"]}}},"required":["integrations"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/integrations/{name}":{"get":{"operationId":"checkIntegration","summary":"Check active integration","tags":["Integrations"],"description":"Returns true if the named integration is active for the given brand (brand resolved via x-brand-id header).","parameters":[{"schema":{"type":"string"},"in":"path","name":"name","required":true},{"schema":{"type":"string","minLength":1},"in":"header","name":"x-brand-id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/services":{"post":{"operationId":"createService","summary":"Create Service","tags":["Services"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"brandId":{"type":"string","minLength":1},"providerId":{"type":"string","minLength":1},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}}},"required":["name"],"additionalProperties":false}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"brandId":{"type":"string"},"providerId":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"visibility":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":["null","string","number"]},"updatedAt":{"type":["null","string"],"format":"date-time"},"updatedBy":{"type":["null","string","number"]}},"required":["_id","name","createdAt"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/services/{serviceId}":{"get":{"operationId":"getService","summary":"Get Service","tags":["Services"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"serviceId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"brandId":{"type":"string"},"providerId":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"visibility":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":["null","string","number"]},"updatedAt":{"type":["null","string"],"format":"date-time"},"updatedBy":{"type":["null","string","number"]}},"required":["_id","name","createdAt"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}},"patch":{"operationId":"updateService","summary":"Update Service","tags":["Services"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"brandId":{"type":"string","minLength":1},"providerId":{"type":"string","minLength":1},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"visibility":{"type":"string","enum":["active","deleted"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"serviceId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"brandId":{"type":"string"},"providerId":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"visibility":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":["null","string","number"]},"updatedAt":{"type":["null","string"],"format":"date-time"},"updatedBy":{"type":["null","string","number"]}},"required":["_id","name","createdAt"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}},"delete":{"operationId":"deleteService","summary":"Delete Service","tags":["Services"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"serviceId","required":true},{"schema":{"type":"string","minLength":1},"in":"header","name":"x-brand-id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/services/list":{"get":{"operationId":"listServices","summary":"List Services","tags":["Services"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"brandId","required":false},{"schema":{"type":"string"},"in":"query","name":"providerId","required":false},{"schema":{"type":"string"},"in":"query","name":"family","required":false},{"schema":{"type":"string"},"in":"query","name":"subFamily","required":false},{"schema":{"type":"string"},"in":"query","name":"groupName","required":false},{"schema":{"type":"string"},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"offset","required":false}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"services":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"brandId":{"type":"string"},"providerId":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"visibility":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":["null","string","number"]},"updatedAt":{"type":["null","string"],"format":"date-time"},"updatedBy":{"type":["null","string","number"]}},"required":["_id","name","createdAt"]}},"total":{"type":"number"}}}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}}}}}}}}},"/v1/services/search/{zipcode}/{radius}":{"get":{"operationId":"searchServicesWithPricing","summary":"Search services by zipcode + radius and compute pricing stats","tags":["Services"],"description":"Validates zipcode, finds providers in radius (or specific providerId(s)), resolves serviceIds, and returns services with min/avg/max prices.","parameters":[{"schema":{"type":"string"},"in":"query","name":"providerId","required":false,"description":"Single providerId or comma-separated list"},{"schema":{"type":"string"},"in":"query","name":"brandId","required":false,"description":"Filter services by brandId"},{"schema":{"type":"string","minLength":3},"in":"path","name":"zipcode","required":true},{"schema":{"type":"string"},"in":"path","name":"radius","required":true},{"schema":{"type":"string"},"in":"header","name":"authorization","required":true,"description":"Bearer <API_KEY>"},{"schema":{"type":"string"},"in":"header","name":"login-token","required":true,"description":"User login token"},{"schema":{"type":"string"},"in":"header","name":"user-id","required":true,"description":"User ID"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"services":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"slug":{"type":"string"},"family":{"type":"string"},"subFamily":{"type":"string"},"groupName":{"type":"string"},"brandId":{"type":"string"},"aliases":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}},"codes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":"string"}},"required":["type","code"]}},"createdAt":{"type":["null","string"],"format":"date-time"},"createdBy":{"type":["null","string","number"]},"minPrice":{"type":["null","number"]},"avgPrice":{"type":["null","number"]},"maxPrice":{"type":["null","number"]}},"required":["_id","name"]}}},"required":["status","services"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["status","statusCode","message"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"statusCode":{"type":"number"},"message":{"type":"string"}},"required":["status","statusCode","message"]}}}}}}},"/v1/brands":{"get":{"operationId":"searchBrands","summary":"Search Brands","tags":["Brands"],"description":"Search brands with optional filtering and pagination. Results are sorted alphabetically by name.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string"},"in":"query","name":"id","required":false,"description":"Filter by exact document ID (_id)"},{"schema":{"type":"string"},"in":"query","name":"name","required":false,"description":"Filter by exact brand name"},{"schema":{"type":"string"},"in":"query","name":"nameShort","required":false,"description":"Filter by exact short name"},{"schema":{"type":"string"},"in":"query","name":"domain","required":false,"description":"Filter by exact domain"},{"schema":{"type":"string"},"in":"query","name":"idContains","required":false,"description":"Filter by document ID containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"nameContains","required":false,"description":"Filter by brand name containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"nameShortContains","required":false,"description":"Filter by short name containing this value (case-insensitive)"},{"schema":{"type":"string"},"in":"query","name":"domainContains","required":false,"description":"Filter by domain containing this value (case-insensitive)"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"returned":{"type":"integer"}},"required":["page","pageSize","total","returned"]},"brands":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"nameShort":{"type":"string"},"subname":{"type":"string"},"domain":{"type":"string"},"colors":{"type":"object","properties":{"primary":{"type":"string"},"secondary":{"type":"string"}},"additionalProperties":true},"logos":{"type":"object","properties":{"favicon":{"type":"string"},"loading":{"type":"string"},"main":{"type":"string"}},"additionalProperties":true},"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"allowEmployerRegistration":{"type":"boolean"},"providers":{"type":"array","items":{"type":"string"}},"integrations":{"type":"object","additionalProperties":true},"hl7Config":{"type":"object","properties":{"url":{"type":"string"},"user":{"type":"string"},"pass":{"type":"string"},"proto":{"type":"string"},"port":{"type":"string"},"interfaceName":{"type":"string"}},"additionalProperties":true},"brandId":{"type":"string"}},"required":["_id"],"additionalProperties":true}}},"required":["meta","brands"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7-systems":{"get":{"operationId":"listHL7Systems","summary":"List HL7 Systems","tags":["HL7 Systems"],"description":"List and search registered HL7 systems with pagination. Results sorted by most recently seen.","parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","enum":["unmapped","active","disabled"]},"in":"query","name":"status","required":false,"description":"Filter by status"},{"schema":{"type":"string"},"in":"query","name":"search","required":false,"description":"Search by name, sendingApplication, or sendingFacility (case-insensitive)"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"returned":{"type":"integer"}},"required":["page","pageSize","total","returned"]},"systems":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}},"required":["meta","systems"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"post":{"operationId":"createHL7System","summary":"Create HL7 System","tags":["HL7 Systems"],"description":"Manually create a new HL7 system registration.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"sendingApplication":{"type":"string","minLength":1},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"notes":{"type":["string","null"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"messageTypes":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean","default":true}},"required":["name","messageTypes","url"],"additionalProperties":false}}},"required":["name","sendingApplication"],"additionalProperties":false}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7-systems/{id}":{"get":{"operationId":"getHL7System","summary":"Get HL7 System","tags":["HL7 Systems"],"description":"Get a single HL7 system by ID.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"put":{"operationId":"updateHL7System","summary":"Update HL7 System","tags":["HL7 Systems"],"description":"Update system name, status, brand linkage, or notes.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"status":{"type":"string","enum":["unmapped","active","disabled"]},"brandId":{"type":["string","null"]},"notes":{"type":["string","null"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"delete":{"operationId":"deleteHL7System","summary":"Delete HL7 System","tags":["HL7 Systems"],"description":"Permanently delete an HL7 system registration.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7-systems/{id}/interfaces":{"post":{"operationId":"addHL7SystemInterface","summary":"Add Interface to HL7 System","tags":["HL7 Systems"],"description":"Add a new outbound interface to an HL7 system. New interfaces are appended to the end of the priority list.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"messageTypes":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"url":{"type":"string","minLength":1},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean","default":true}},"required":["name","messageTypes","url"],"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7-systems/{id}/interfaces/{interfaceId}":{"put":{"operationId":"updateHL7SystemInterface","summary":"Update HL7 System Interface","tags":["HL7 Systems"],"description":"Update an existing interface on an HL7 system.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"messageTypes":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"url":{"type":"string","minLength":1},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":["string","null"]},"password":{"type":["string","null"]},"interfaceName":{"type":["string","null"]},"enabled":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"interfaceId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}},"delete":{"operationId":"removeHL7SystemInterface","summary":"Remove HL7 System Interface","tags":["HL7 Systems"],"description":"Remove an outbound interface from an HL7 system.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"interfaceId","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/hl7-systems/{id}/interfaces/reorder":{"put":{"operationId":"reorderHL7SystemInterfaces","summary":"Reorder HL7 System Interfaces","tags":["HL7 Systems"],"description":"Change the priority order of interfaces. First match wins when routing outbound messages.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"interfaceIds":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["interfaceIds"],"additionalProperties":false}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"sendingApplication":{"type":"string"},"sendingFacility":{"type":"string"},"receivingApplication":{"type":"string"},"receivingFacility":{"type":"string"},"systemKey":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["unmapped","active","disabled"]},"interfaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"messageTypes":{"type":"array","items":{"type":"string"}},"url":{"type":"string"},"method":{"type":"string","enum":["POST","PUT"]},"headers":{"type":"object","additionalProperties":{"type":"string"}},"username":{"type":"string"},"password":{"type":"string"},"interfaceName":{"type":"string"},"enabled":{"type":"boolean"}},"required":["id","name","messageTypes","url","enabled"]}},"brandId":{"type":"string"},"autoRegistered":{"type":"boolean"},"firstSeenAt":{"type":"string","format":"date-time"},"lastSeenAt":{"type":"string","format":"date-time"},"messageCount":{"type":"integer"},"lastMessageType":{"type":"string"},"notes":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["_id","sendingApplication","sendingFacility","receivingApplication","receivingFacility","systemKey","name","status"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/send":{"post":{"operationId":"sendRawEmail","summary":"Send Raw Email","tags":["Email"],"description":"Send a raw HTML email without template processing. Internal use only.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"description":"Array of recipient email addresses"},"subject":{"type":"string","minLength":1,"pattern":"^[^\\r\\n]*$","description":"Email subject line (must not contain newline characters)"},"html":{"type":"string","minLength":1,"description":"Raw HTML content to send"}},"required":["to","subject","html"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"True if all emails were sent successfully, false if any failed"},"statuses":{"type":"array","items":{"type":"object","properties":{"recipient":{"type":"string","description":"Recipient email address"},"emailToken":{"type":["null","string"],"description":"Tracking token for this email, null if send failed"},"success":{"type":"boolean","description":"Whether this email was sent successfully"}},"required":["recipient","emailToken","success"]},"description":"Status for each recipient"}},"required":["success","statuses"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/templates/{name}/send":{"post":{"operationId":"sendTemplatedEmail","summary":"Send Templated Email","tags":["Email"],"description":"Send an email using a registered template. Internal use only.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"array","items":{"type":"string","format":"email"},"minItems":1,"description":"Array of recipient email addresses"},"variables":{"type":"object","additionalProperties":true,"description":"Template variables to interpolate"}},"required":["to","variables"]}}},"required":true},"parameters":[{"schema":{"type":"string"},"in":"path","name":"name","required":true,"description":"Template name"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","description":"True if all emails were sent successfully, false if any failed"},"statuses":{"type":"array","items":{"type":"object","properties":{"recipient":{"type":"string","description":"Recipient email address"},"emailToken":{"type":["null","string"],"description":"Tracking token for this email, null if send failed"},"success":{"type":"boolean","description":"Whether this email was sent successfully"}},"required":["recipient","emailToken","success"]},"description":"Status for each recipient"},"templateUsed":{"type":"string","description":"Name of the template used"}},"required":["success","statuses","templateUsed"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/templates":{"get":{"operationId":"listEmailTemplates","summary":"List Email Templates","tags":["Email"],"description":"Get a list of all available email templates. Internal use only.","security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Template identifier"},"description":{"type":"string","description":"Human-readable description"},"variables":{"type":"array","items":{"type":"string"},"description":"Required variable names"}},"required":["name","description","variables"]}}},"required":["templates"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/templates/{name}":{"get":{"operationId":"getEmailTemplate","summary":"Get Email Template","tags":["Email"],"description":"Get detailed schema for a specific email template. Internal use only.","parameters":[{"schema":{"type":"string"},"in":"path","name":"name","required":true,"description":"Template name"}],"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Template identifier"},"description":{"type":"string","description":"Human-readable description"},"file":{"type":"string","description":"Template file path"},"variables":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"required":{"type":"boolean"}},"required":["name","description","required"]},"description":"Variable definitions with descriptions"}},"required":["name","description","file","variables"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/orderAccepted/employer":{"post":{"operationId":"triggerOrderAcceptedEmployer","summary":"Trigger Order Accepted Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when an order is accepted by a provider. Takes an orderItemId since acceptance is per-provider.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for (represents a specific provider portion of an order)"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/resultsUploaded/employer":{"post":{"operationId":"triggerResultsUploadedEmployer","summary":"Trigger Results Uploaded Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when results are uploaded for an order. Checks both email-order-results-added and email-employer-admin preferences.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for (represents a specific provider portion of an order)"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/orderSent/employee":{"post":{"operationId":"triggerOrderSentEmployee","summary":"Trigger Order Sent Email to Employee","tags":["Email Triggers"],"description":"Send an email notification to the employee when their order has been sent to a provider. Order-level trigger that takes an orderId.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderId":{"type":"string","minLength":1,"description":"The Order ID to trigger the email for (order-level trigger)"}},"required":["orderId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/orderSent/provider":{"post":{"operationId":"triggerOrderSentProvider","summary":"Trigger Order Sent Email to Provider","tags":["Email Triggers"],"description":"Send an email notification to provider users when a new order is received. Takes an orderItemId since orders are received per-provider.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for (represents a specific provider portion of an order)"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/orderRejected/employer":{"post":{"operationId":"triggerOrderRejectedEmployer","summary":"Trigger Order Rejected Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when an order is rejected by a provider. Includes optional rejection reason.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for"},"reason":{"type":"string","description":"Optional reason for the rejection"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/orderUpdated/employer":{"post":{"operationId":"triggerOrderUpdatedEmployer","summary":"Trigger Order Updated Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when an order status changes. Includes optional previous and new status.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for"},"previousStatus":{"type":"string","description":"The previous status of the order item"},"newStatus":{"type":"string","description":"The new status of the order item"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/newMessage/employer":{"post":{"operationId":"triggerNewMessageEmployer","summary":"Trigger New Message Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when a new message is posted on an order by a provider or concierge.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for"},"senderType":{"type":"string","enum":["provider","concierge"],"description":"Who sent the message: provider or concierge"}},"required":["orderItemId","senderType"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/employeeNotified/employer":{"post":{"operationId":"triggerEmployeeNotifiedEmployer","summary":"Trigger Employee Notified Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when an employee has been notified about their order via email or SMS.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for"},"method":{"type":"string","enum":["email","sms"],"description":"How the employee was notified: email or sms"}},"required":["orderItemId","method"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}},"/v1/email/trigger/employeeConfirmed/employer":{"post":{"operationId":"triggerEmployeeConfirmedEmployer","summary":"Trigger Employee Confirmed Email to Employer","tags":["Email Triggers"],"description":"Send an email notification to employer admins when an employee confirms their appointment.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"orderItemId":{"type":"string","minLength":1,"description":"The OrderItem ID to trigger the email for"}},"required":["orderItemId"]}}},"required":true},"security":[{"ApiKeyAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean","description":"Whether the email was sent successfully"},"recipientCount":{"type":"number","description":"Number of recipients the email was sent to"},"reason":{"type":"string","description":"Reason why the email was not sent (if sent is false)"}},"required":["sent"]}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"},"statusCode":{"type":"number"}},"required":["error","message","statusCode"]}}}}}}}},"servers":[{"url":"https://api.bluehive.com","description":"Production server"}]}