Skip to main content
ClinikAPI gives you a managed FHIR R4 data layer you can start using in minutes. This guide walks you through getting an API key, installing the SDK, and creating and querying your first patient record. All steps use the test environment — no production data or credit card required.
1

Get your API key

Sign up at dashboard.clinikapi.com and create an organization. You receive two API keys immediately:
Key prefixEnvironmentDatastore
clk_test_*SandboxShared test HealthLake
clk_live_*ProductionShared prod (Free/Pro) or dedicated (Enterprise)
Test keys are available on all plans including Sandbox. Use them for development and CI/CD — data is isolated from production and you cannot accidentally write to live records.
Copy your test key now and store it as CLINIKAPI_SECRET_KEY in your .env file. Never commit API keys to source control.
2

Install the SDK

Install the @clinikapi/sdk package from npm:
npm install @clinikapi/sdk
The SDK is server-side only. Never import it in client-side code — your API key would be exposed to the browser. For frontend UI, use @clinikapi/react with the proxy pattern.
3

Create a patient

Instantiate the client with your secret key and create your first patient record. ClinikAPI handles the FHIR R4 transformation and stores the resource in AWS HealthLake.
import { Clinik } from '@clinikapi/sdk';

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

async function main() {
  const { data: patient, meta } = await clinik.patients.create({
    firstName: 'Jane',
    lastName: 'Doe',
    email: '[email protected]',
    gender: 'female',
    birthDate: '1990-03-15',
    address: {
      line: ['123 Main St'],
      city: 'Austin',
      state: 'TX',
      postalCode: '78701',
      country: 'US',
    },
  });

  console.log('Patient ID:', patient.id);       // "pt_abc123"
  console.log('Request ID:', meta.requestId);   // for support tickets
  console.log('Rate limit remaining:', meta.rateLimitRemaining);
}

main();
Every SDK method returns an ApiResponse<T> with two top-level fields:
interface ApiResponse<T> {
  data: T;          // The resource or result
  meta: {
    requestId: string;           // For support tickets
    timestamp: string;           // ISO 8601
    status: number;              // HTTP status
    rateLimitTotal?: number;     // Requests allowed per window
    rateLimitRemaining?: number; // Requests left
    rateLimitReset?: number;     // Seconds until reset
  };
}
4

Read back with related resources

Use the include option to fetch a patient alongside related FHIR resources in a single request:
const { data: full } = await clinik.patients.read(patient.id!, {
  include: ['Encounter', 'Observation'],
});

console.log('Encounters:', full.encounters.length);
console.log('Observations:', full.observations.length);
The include array accepts any of the 14 FHIR resource type names. ClinikAPI executes the related lookups server-side and returns all data in one response.
5

Search patients

Search across patients using any combination of supported parameters. Results are automatically scoped to your tenant — you only see records that belong to your organization.
const { data: results } = await clinik.patients.search({
  name: 'Doe',
  count: 10,
});

console.log('Found:', results.data.length, 'patients');

Next steps