Create a Connect Session
Authorization
BearerAuth AuthorizationBearer <token>
Medblocks API key for server-side requests.
In: header
Header Parameters
Version?string
Date-pinned API version. If omitted, Medblocks uses the version pinned on your API key.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/sessions" \ -H "Version: 2026-04-25" \ -H "Content-Type: application/json" \ -d '{ "patient_id": "user_42", "patient_email": "jane@example.com", "patient_name": "Jane Doe", "recommended_connection_ids": [ "fhirsrc_02Zh2bnvRoWQJYgOAkI0Twcc", "fhirsrc_0a9Ea55aR4u7HaWMyFBN8wcc", "fhirsrc_lcvXRHLSSI2WK9Prrt5Qggcc" ], "return_url": "https://app.example.com/connected", "return_button_label": "Acme Health", "expires_in": 1800, "metadata": { "signup_source": "checkout" } }'{ "id": "sess_01J9YQ8M2X4VZ6P2K5RH7M3KQT", "resource_type": "session", "status": "open", "url": "https://app.medblocks.com/c/9c9b6f7a8e4f4a3b9c1e6f3a2d8b7c4d", "patient_id": "user_42", "connection_id": null, "recommended_connection_ids": [ "fhirsrc_02Zh2bnvRoWQJYgOAkI0Twcc", "fhirsrc_0a9Ea55aR4u7HaWMyFBN8wcc", "fhirsrc_lcvXRHLSSI2WK9Prrt5Qggcc" ], "return_url": "https://app.example.com/connected", "return_button_label": "Acme Health", "connections": [], "expires_at": "2026-04-25T15:00:00.000Z", "metadata": { "signup_source": "checkout" }, "created_at": "2026-04-25T14:30:00.000Z"}{ "error": { "type": "string", "code": "string", "message": "string", "param": "string", "doc_url": "http://example.com", "request_id": "string" }}Non-2xx responses use the standard API error envelope. Log
error.code and error.request_id for support.patient_id*string
Stable patient ID from your system. Creates the Patient if needed.
Length
1 <= lengthpatient_email?string
Patient email to store or update.
Format
emailpatient_name?string
Patient display name to store or update.
connection_id?string
Source ID from /connections. Used for Direct Mode. Mutually exclusive with recommended_connection_ids.
Length
1 <= lengthrecommended_connection_ids?array<>
Source IDs to show first in the hosted picker. Mutually exclusive with connection_id.
return_url*string
URL to redirect after the Connect flow.
Format
urireturn_button_label?string
Text shown on the patient-facing completion button.
Length
1 <= length <= 60expires_in?integer
Seconds until the session expires.
Range
60 <= value <= 86400metadata?
Additional metadata returned with the Session.
