Authentication
ClinikAPI uses API key authentication via thex-api-key header. Every request must include a valid key.
API Keys
Keys are created in the Developer Dashboard and follow this format:ClinikAPI is a Data API
ClinikAPI does not handle end-user authentication. You bring your own auth provider (Clerk, Auth0, Firebase, etc.) and use ClinikAPI purely for clinical data storage and retrieval.Tenant Isolation
Every resource stored in ClinikAPI is tagged with your organization’s tenant ID:- On create: the tenant tag is automatically injected
- On search: a
_tagfilter is automatically applied — you can only see your own data - On read/update/delete: ownership is verified before the operation proceeds
Multi-Datastore Routing
Requests are routed to different datastores based on your key and plan:
Enterprise customers get a fully isolated datastore provisioned in their preferred region.
Key Validation Flow
For minimal latency, API keys are validated against a co-located PostgreSQL database that mirrors your dashboard data:- You create/revoke keys in the Dashboard
- Key changes are automatically synced to the co-located database
- The API validates keys locally — no cross-region round trips
Key Scopes
API keys can be scoped to specific permissions:read— GET operations onlywrite— POST, PATCH, DELETE operations*— full access (default)
Security Best Practices
- Store keys in environment variables (
CLINIKAPI_SECRET_KEY) - Use
clk_test_*keys for development — they route to an isolated test datastore - Rotate keys periodically from the Dashboard
- Use scoped keys when possible (e.g., read-only for analytics services)
- For client-side UI, use
@clinikapi/reactwith the proxy pattern