{"openapi":"3.0.3","info":{"title":"Agentic Chat API","version":"1.0.0","description":"AI-powered chat API backed by AWS Bedrock AgentCore Runtime."},"servers":[{"url":"https://agentic-chat.bswiftdev.com","description":"Development"},{"url":"Not Live Yet","description":"QA"},{"url":"Not Live Yet","description":"UAT"},{"url":"Not Live Yet","description":"Production"}],"paths":{"/chat/{app_name}":{"post":{"summary":"Send a chat message","description":"Processes a user message through the conversation pipeline. Returns a widget-based response from the executor.\n","parameters":[{"name":"app_name","in":"path","required":true,"description":"Application identifier (e.g. adminpro, eva)","schema":{"type":"string","example":"adminpro"}}],"security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"},"example":{"message_id":"a1b2c3d4-1234-5678-abcd-ef12345678902","session_id":"test-session-adminpro-0012345678902","user_id":"29864331","customer_id":"2ccaea08-9fbf-40fc-b9ab-f7435d7d2ae8","messages":"How many employees logged in last 5 month?","metadata":{"channel":"adminpro","claims_enabled":false}}}}},"responses":{"200":{"description":"Successful response containing the executor-generated model output","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"},"examples":{"model_response_with_widgets":{"summary":"Example response with text and data-table widgets","value":{"message_id":"a1b2c3d4-1234-5678-abcd-ef12345678902","session_id":"test-session-adminpro-0012345678902","status_code":200,"response":{"widgets":[{"type":"text","subtype":"content","data":"<h3>Members Primarily Diagnosed with Diabetes</h3><p><strong>76,451 unique members</strong> have diabetes as their primary diagnosis (diag1 field in claims).</p>"},{"type":"widget","subtype":"data-table","data":{"title":"Breakdown by Diabetes Type:","columns":[{"key":"diabetesType","label":"Diabetes Type"},{"key":"icdCode","label":"ICD-10 Code","width":"100px"},{"key":"members","label":"Members","align":"right"},{"key":"claims","label":"Claims","align":"right"}],"rows":[{"diabetesType":"Type 2 Diabetes","icdCode":"E11","members":"71,617 (93.7%)","claims":"500,967"},{"diabetesType":"Type 1 Diabetes","icdCode":"E10","members":"7,002 (9.2%)","claims":"74,671"},{"diabetesType":"Other Specified Diabetes","icdCode":"E13","members":"1,235 (1.6%)","claims":"3,453"},{"diabetesType":"Diabetes due to Underlying Condition","icdCode":"E08","members":"430 (0.6%)","claims":"845"},{"diabetesType":"Drug/Chemical Induced Diabetes","icdCode":"E09","members":"92 (0.1%)","claims":"215"}],"caption":"Note: The vast majority (93.7%) have Type 2 Diabetes as their primary diagnosis, with Type 1 Diabetes being the second most common at 9.2%."}}]},"metadata":{}}},"model_response_text":{"summary":"Example response with text-only content widget","value":{"message_id":"a1b2c3d4-1234-5678-abcd-ef12345678904","session_id":"test-session-adminpro-0012345678904","status_code":200,"response":{"widgets":[{"type":"text","subtype":"content","data":"<p>Once the <strong>Enable ACA Reporting + Hours Tracking</strong> option has been checked in the Affordable Care Act (ACA) section of the Client Options page, administrators can configure ACA options on the ACA Client Options page under <strong>Clients >> Client Admin >> ACA Client Options</strong>.</p>"}]},"metadata":{}}}}}}},"400":{"description":"Bad request — missing or invalid field","content":{"application/json":{"schema":{"type":"object","properties":{"status_code":{"type":"integer"},"error":{"type":"string"}}},"examples":{"missing_message_id":{"value":{"status_code":400,"error":"Missing required field: 'message_id'"}},"missing_session_id":{"value":{"status_code":400,"error":"Missing required field: 'session_id'"}},"missing_user_id":{"value":{"status_code":400,"error":"Missing required field: 'user_id'"}},"missing_customer_id":{"value":{"status_code":400,"error":"Missing required field: 'customer_id'"}},"missing_messages":{"value":{"status_code":400,"error":"Missing required field: 'messages'"}},"missing_auth":{"value":{"status_code":400,"error":"Missing required header: 'Authorization'"}},"missing_metadata":{"value":{"status_code":400,"error":"Missing required field: 'metadata'"}},"invalid_claims_enabled":{"value":{"status_code":400,"error":"'metadata.claims_enabled' must be a boolean value"}}}}}},"401":{"description":"Unauthorized — missing or invalid token","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}},"example":{"error":"Authentication required"}}}},"404":{"description":"App not found","content":{"application/json":{"schema":{"type":"object","properties":{"status_code":{"type":"integer"},"error":{"type":"string"}}},"example":{"status_code":404,"error":"Invalid app: 'unknown'"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status_code":{"type":"integer"},"error":{"type":"string"}}},"example":{"status_code":500,"error":"We're sorry, but something unexpected occurred. Please try again later."}}}}}}},"/agents-invoked":{"post":{"summary":"Get agents invoked for a message","description":"Returns the DynamoDB record for the given message_id, including the list of agents invoked during processing.\n","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["message_id"],"properties":{"message_id":{"type":"string","example":"a1b2c3d4-1234-5678-abcd-ef1234567890"}}}}}},"responses":{"200":{"description":"Record found — returns the full DynamoDB item","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentsInvokedResponse"},"example":{"message_id":"a1b2c3d4-1234-5678-abcd-ef1234567890","session_id":"user123-1745000000","timestamp":"2026-04-22T10:30:00.123456+00:00","agents_invoked":["adminpro_analytics"],"expiry_time":1745086400}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"status_code":{"type":"integer"},"error":{"type":"string"}}},"example":{"status_code":400,"error":"Missing required field: 'message_id'"}}}},"401":{"description":"Missing or invalid Authorization header"},"404":{"description":"No record found for the given message_id"},"405":{"description":"Non-POST request method"},"500":{"description":"MESSAGE_STATUS_TABLE env var not set, or DynamoDB error"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"AWS Cognito JWT access token"}},"schemas":{"ChatRequest":{"type":"object","required":["message_id","session_id","user_id","customer_id","messages","metadata"],"properties":{"message_id":{"type":"string","description":"Unique identifier for this message (UUID recommended)","example":"a1b2c3d4-1234-5678-abcd-ef12345678902"},"session_id":{"type":"string","description":"Session identifier — minimum 33 characters (padded with zeros if shorter)","example":"test-session-adminpro-0012345678902"},"user_id":{"type":"string","description":"User identifier (maps to upin internally)","example":"29864331"},"customer_id":{"type":"string","description":"Customer / client identifier","example":"2ccaea08-9fbf-40fc-b9ab-f7435d7d2ae8"},"messages":{"oneOf":[{"type":"string","description":"Single user message text","example":"How many employees logged in last 5 month?"},{"type":"array","description":"Conversation history as a list of message objects","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"text":{"type":"string"}}}}]},"metadata":{"type":"object","properties":{"channel":{"type":"string","description":"Channel the request originated from","default":"adminpro","example":"adminpro"},"claims_enabled":{"type":"boolean","description":"Optional flag indicating whether claims data is enabled for the user.","example":false}},"additionalProperties":true}}},"ChatResponse":{"type":"object","properties":{"message_id":{"type":"string","example":"a1b2c3d4-1234-5678-abcd-ef12345678902"},"session_id":{"type":"string","example":"test-session-adminpro-0012345678902"},"status_code":{"type":"integer","example":200},"response":{"type":"object","properties":{"widgets":{"type":"array","items":{"$ref":"#/components/schemas/Widget"}}}},"metadata":{"type":"object","description":"Always returns an empty object"}}},"Widget":{"type":"object","properties":{"type":{"type":"string","enum":["text","widget"],"example":"text"},"subtype":{"type":"string","enum":["content","data-table"],"example":"content"},"data":{"description":"String for text widgets; object for data-table widgets","oneOf":[{"type":"string"},{"type":"object"}]}}},"AgentsInvokedResponse":{"type":"object","properties":{"message_id":{"type":"string"},"session_id":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"agents_invoked":{"type":"array","items":{"type":"string"}},"expiry_time":{"type":"integer"}}}}}}