SDK
The official @medblocks/connect TypeScript SDK for the Medblocks Platform API.
@medblocks/connect is the official TypeScript SDK for the Medblocks Platform API. It wraps every public endpoint with typed inputs, typed responses, a typed error hierarchy, and helpers for the patient-redirect return URL and webhook signature verification.
The SDK is server-first. It targets backends that hold the secret key — Node.js, Next.js, Bun, and any modern runtime with fetch. A small set of side-effect-free helpers (parseReturnUrl) is safe to import from browser code. This release is pinned to API version 2026-04-25.
In This Section
Quickstart
Picker mode end to end in six steps.
PatientFlow
mb.patientFlow.init and retrieve for picker and direct mode.
Patients
CRUD plus the getConnections hydrate helper.
Connections
Search the EHR catalog for custom pickers.
Return URL
Frontend-safe parser for the post-flow query string.
Errors
Typed error hierarchy with instanceof discrimination.
Pagination
ListPromise, Page, and autoPagingIterator.
Advanced
Timeouts, retries, custom fetch, AbortSignal.
Looking for mb.webhooks.* (register endpoints, rotate secrets, inspect deliveries) or mb.events.redeliver? Those live with the Webhooks · Managing Endpoints and Webhooks · Redelivery pages.
If you are building in Python, Ruby, Java, Go, .NET, or any other language, use the REST API directly.
