Skip to main content

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
Install it from your private registry or directly from npm:

1. Initialize the client

  • apiKey is 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

The 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

Assessments are processed asynchronously. You can either:
  • Receive an assessment.completed webhook, or
  • Poll the getAssessment endpoint.

5. Retrieve an assessment

6. Configure webhooks

Use configureTenantWebhook to register where Marmar should send outbound events:
The secret is used to sign webhook payloads. You will use the same value to verify incoming webhooks on your server.

7. Verify webhook signatures

Use verifyWebhookSignature to authenticate webhook deliveries and guard against tampering and replay attacks.
For tests or local tooling, you can generate signatures using signWebhookPayload:

8. Error handling

All client methods throw an ApiError when the Marmar API returns a non‑2xx status code.

9. Advanced: using generated types and FHIR

The SDK exposes the OpenAPI types for all endpoints, including FHIR operations. You can use these types even when making custom HTTP calls:
For example, to submit a FHIR bundle using your own HTTP client:
For more on FHIR ingestion and search, see the dedicated FHIR guide in this documentation.