Package Exports
- @incheckai/sdk
Readme
InCheck Node.js SDK
TypeScript-first Node.js SDK for InCheck AI APIs.
Install
npm install @incheckai/sdk
# or
pnpm add @incheckai/sdk
# or
yarn add @incheckai/sdk
# or
bun add @incheckai/sdkRequirements
- Node.js
>=18
Authentication
An API key is required. Provide it in one of these ways:
- Constructor option:
apiKey - Environment variable:
INCHECK_API_KEY
If neither is set, client initialization fails with a validation error.
import { Client } from "@incheckai/sdk";
// Option 1: pass apiKey explicitly
const clientWithApiKey = new Client({
apiKey: "your_api_key_here",
environment: "production"
});
// Option 2: omit apiKey and use INCHECK_API_KEY from environment
const client = new Client({
environment: "production"
});Environment and Base URL
Resolution order:
baseUrloptionINCHECK_BASE_URLenvironmentoption ("production" | "staging")INCHECK_ENVIRONMENT- Production default (
https://api.incheck.ai)
Staging URL:
https://api-acceptance.incheck.ai
const client = new Client({
environment: "staging"
});Client Exports
IncheckClientClient(alias)AsyncClient(alias)
Chat (EMS / Unified)
One-shot response
const result = await client.chat.create({
content: "Summarize this patient note.",
options: {
orgId: "org_123", // optional; omit for EMS mode
userId: "user_42"
}
});
console.log(result.content);Streaming response
for await (const chunk of client.chat.stream({
content: "Give me a step-by-step care plan.",
options: { orgId: "org_123" }
})) {
if (chunk.content) process.stdout.write(chunk.content);
}Documents
List orgs / documents
const orgs = await client.documents.listOrgs();
const docs = await client.documents.list("org_123");
// Normalization: download_url falls back to presigned_url
console.log(docs.documents[0]?.download_url);Current documents.list response shape (live API):
{
"org_id": "org_id",
"version": "20260511_213242",
"document_count": 1,
"documents": [
{
"filename": "test_pdf_without_toc.pdf",
"size_bytes": 4364,
"last_modified": "2026-05-11T21:32:44+00:00",
"presigned_url": "https://...X-Amz-Expires=3600...",
"url_expires_in": 3600
}
],
"job_id": "b248ff0c-e2e7-494c-a91e-5d14d2b6337a",
"s3_folder": "org_id/org_123/2026/05/11/20260511_213242"
}Notes:
documents[].idis not guaranteed by this endpoint.- SDK normalization ensures
documents[].download_urlfalls back frompresigned_url. - Presigned URLs are time-limited (
url_expires_in, commonly3600seconds).
Upload files
import { readFile } from "node:fs/promises";
const status = await client.documents.upload(
"org_123",
[
"./docs/protocol.pdf",
{ filename: "extra.txt", data: new Uint8Array(await readFile("./docs/extra.txt")) }
],
{
batchSize: 6,
wait: true,
timeoutMs: 600_000,
pollIntervalMs: 10_000
}
);
console.log(status.status);Error Handling
import {
IncheckAuthenticationError,
IncheckRateLimitError,
IncheckValidationError
} from "incheck-nodejs";
try {
await client.chat.create({ content: "Hello" });
} catch (error) {
if (error instanceof IncheckAuthenticationError) {
console.error("Bad API key");
} else if (error instanceof IncheckRateLimitError) {
console.error("Rate limited", error.message);
} else if (error instanceof IncheckValidationError) {
console.error("Validation issue", error.message);
} else {
console.error("Unhandled error", error);
}
}