Skip to main content
ConsentManager is a widget for presenting consent documents to patients, capturing digital signatures, and tracking the full consent lifecycle. It displays the consent document with its scope, category, and policy link, then guides the patient through signing. Status transitions — from draft through proposed, active, or rejected — are all managed through a backend proxy you control.
Your ClinikAPI secret key must stay on the server. The ConsentManager widget sends all consent operations to your proxyUrl. Your backend proxy is responsible for verifying the patient’s identity before recording consent.

Props

props.proxyUrl
string
required
URL of your backend proxy endpoint. The widget sends GET requests to load consent documents and PATCH requests to update consent status when the patient signs or declines.
props.className
string
CSS class name applied to the widget’s root element for layout and theming control.
props.onError
(error: Error) => void
Callback invoked when a load or update request to your proxy fails. Use this to alert the patient and prevent the flow from proceeding without a recorded consent decision.

Proxy setup

Your proxy needs to return consent documents on GET and accept status updates on PATCH. The example below shows a Next.js App Router implementation:
// app/api/clinik/consents/route.ts
import { Clinik } from '@clinikapi/sdk';

const clinik = new Clinik(process.env.CLINIKAPI_SECRET_KEY!);

// GET: load pending consent documents for the patient
export async function GET(req: Request) {
  const url = new URL(req.url);
  const patientId = url.searchParams.get('patientId');

  const { data } = await clinik.consents.search({ patientId: patientId! });
  return Response.json(data);
}
// app/api/clinik/consents/[id]/route.ts
import { Clinik } from '@clinikapi/sdk';

const clinik = new Clinik(process.env.CLINIKAPI_SECRET_KEY!);

// PATCH: update consent status (e.g. proposed → active after signing)
export async function PATCH(
  req: Request,
  { params }: { params: { id: string } }
) {
  const body = await req.json();
  const { data } = await clinik.consents.update(params.id, body);
  return Response.json(data);
}
Record the timestamp and authenticated user identity alongside each consent update in your proxy. Consent audit trails are a regulatory requirement in most healthcare jurisdictions.

Usage

import { ConsentManager } from '@clinikapi/react';

export default function ConsentPage({ patientId }: { patientId: string }) {
  return (
    <ConsentManager
      proxyUrl={`/api/clinik/consents?patientId=${patientId}`}
      onError={(err) => console.error('Consent manager error:', err)}
    />
  );
}

Features

  • Consent document display: renders the document with its scope, category, and applicable policy URI
  • Digital signature capture: collects a patient signature as part of the consent record
  • Status tracking: manages transitions through the draft → proposed → active → rejected lifecycle
  • Verification status display: shows whether the consent has been verified by a clinician
  • Policy URI linking: links out to the full policy document referenced by the consent record
Consents are stored as FHIR Consent resources. The widget maps signature events to the appropriate FHIR status transitions, so your consent records are immediately available through the ClinikAPI search and read endpoints.