{"openapi":"3.0.3","info":{"title":"Scout Intake","description":"HMAC-verified referral and Lexamica outcome webhooks enqueue to SQS. Thin public receiver only — no DB, gates, or LLM in this process.","version":"0.1.0"},"paths":{"/":{"get":{"summary":"Service docs","description":"HTML landing page with service meta, live status, and Redoc API reference.","operationId":"getHome","responses":{"200":{"description":"HTML docs page","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/healthz":{"get":{"summary":"Liveness","description":"Process liveness probe. Does not check SQS or downstream.","operationId":"getHealthz","responses":{"200":{"description":"Process is up","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","enum":[true]}}}}}}}}},"/openapi.json":{"get":{"summary":"OpenAPI document","description":"Machine-readable OpenAPI 3 spec for intake HTTP routes.","operationId":"getOpenApi","responses":{"200":{"description":"OpenAPI 3 JSON","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/webhooks/referral":{"post":{"summary":"Referral webhook","description":"Accept a referral invitation payload, verify HMAC over the raw body, enqueue to the intake SQS queue, and return 202.","operationId":"postReferralWebhook","security":[{"HmacSignature":[]}],"parameters":[{"name":"X-Signature","in":"header","required":true,"description":"HMAC signature: `sha256=<hex>` over the raw request body.","schema":{"type":"string","example":"sha256=abc..."}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralWebhookBody"}}}},"responses":{"202":{"description":"Accepted and enqueued","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralAccepted"}}}},"400":{"description":"Invalid JSON or missing referral_invitation_id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Invalid or missing HMAC signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}},"/webhooks/lexamica":{"post":{"summary":"Lexamica outcome webhook","description":"Lexamica lifecycle events (Declined / Evaluated / Accepted). Actionable events enqueue; unknown or ignored events return 202 with `enqueued: false`.","operationId":"postLexamicaWebhook","security":[{"HmacSignature":[]},{"LexamicaSignature":[]}],"parameters":[{"name":"X-Lexamica-Signature","in":"header","required":false,"description":"Preferred HMAC header: `sha256=<hex>` over the raw request body. Falls back to `X-Signature`.","schema":{"type":"string"}},{"name":"X-Signature","in":"header","required":false,"description":"Legacy HMAC header used when `X-Lexamica-Signature` is absent.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LexamicaOutcomeBody"}}}},"responses":{"202":{"description":"Accepted (enqueued or no-op)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LexamicaAccepted"}}}},"400":{"description":"Invalid JSON, payload, or missing invitation id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}},"401":{"description":"Invalid or missing HMAC signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorBody"}}}}}}}},"components":{"securitySchemes":{"HmacSignature":{"type":"apiKey","in":"header","name":"X-Signature","description":"HMAC-SHA256 of the raw request body, formatted as `sha256=<hex>`. The signing secret is distinct per firm and derived server-side from `LEXAMICA_WEBHOOK_SECRET_MASTER`."},"LexamicaSignature":{"type":"apiKey","in":"header","name":"X-Lexamica-Signature","description":"Preferred Lexamica HMAC header. Same `sha256=<hex>` format; takes precedence over `X-Signature`."}},"schemas":{"ErrorBody":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"ReferralWebhookBody":{"type":"object","required":["referral_invitation_id"],"properties":{"referral_invitation_id":{"type":"string","minLength":1},"referral_id":{"type":"string"},"firm_id":{"type":"string","description":"Handling firm receiving the referral"},"referring_firm_id":{"type":"string","nullable":true},"referring_firm_name":{"type":"string","nullable":true,"description":"Originating firm that holds the client's prior inquiry relationship. Required for SMS discovery; absent attribution fails closed and no SMS is sent."},"client_first_name":{"type":"string","nullable":true},"client_last_name":{"type":"string","nullable":true},"client_phone":{"type":"string","nullable":true},"incident_state":{"type":"string","nullable":true},"incident_date":{"type":"string","nullable":true,"description":"ISO date (YYYY-MM-DD) preferred; full ISO timestamps are accepted and normalized to the calendar day"},"case_type":{"type":"string","nullable":true},"incident_synopsis":{"type":"string","nullable":true}},"additionalProperties":true},"ReferralAccepted":{"type":"object","required":["accepted","referral_invitation_id"],"properties":{"accepted":{"type":"boolean","enum":[true]},"referral_invitation_id":{"type":"string"}}},"LexamicaOutcomeBody":{"type":"object","required":["subscription_event"],"properties":{"subscription_event":{"type":"string","description":"Lifecycle event name. Actionable: Case Invitation Declined, Case Invitation Evaluated, Case Invitation Accepted."},"subscription_id":{"type":"string"},"organization_id":{"type":"string"},"referral_invitation_id":{"type":"string"},"invitation_id":{"type":"string","description":"Alias for referral_invitation_id"},"case_invitation_id":{"type":"string","description":"Alias for referral_invitation_id"},"firm_id":{"type":"string"},"handling_firm_id":{"type":"string"},"handling_firm_name":{"type":"string"},"referring_firm_id":{"type":"string"},"referring_firm_name":{"type":"string"},"decline_reason":{"type":"string","nullable":true},"decided_at":{"type":"string","nullable":true}},"additionalProperties":true},"LexamicaAccepted":{"type":"object","required":["accepted","enqueued"],"properties":{"accepted":{"type":"boolean","enum":[true]},"enqueued":{"type":"boolean"},"referral_invitation_id":{"type":"string"}}}}}}