Start Here
The TypeScript SDK provides typed helpers for interacting with the Marmar CDS API. It wraps the most common workflows:- Managing patients
- Creating and retrieving medication safety assessments
- Configuring and verifying webhooks
- Working with fully typed request/response and FHIR models
1. Initialize the client
apiKeyis your tenant API key from the Dashboard.- The API key is scoped to your tenant, so no separate tenant code is needed.
- The SDK automatically sends
Authorization: Bearer <apiKey>headers.
2. Create or update a patient
patient.patientId is a stable Marmar identifier that you can use in
subsequent requests.
To list patients for the current tenant:
3. Create a medication safety assessment
- Receive an
assessment.completedwebhook, or - Poll the
getAssessmentendpoint.
5. Retrieve an assessment
6. Configure webhooks
UseconfigureTenantWebhook to register where Marmar should send outbound events:
secret is used to sign webhook payloads. You will use the same value to
verify incoming webhooks on your server.
7. Verify webhook signatures
UseverifyWebhookSignature to authenticate webhook deliveries and guard
against tampering and replay attacks.
signWebhookPayload:
8. Error handling
All client methods throw anApiError when the Marmar API returns a non‑2xx
status code.