-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Install the client, create it with an API key, and make one working call.
npm install @ontomorph/holon-clientpnpm add @ontomorph/holon-clientyarn add @ontomorph/holon-clientbun add @ontomorph/holon-clientThe client has one dependency, @ontomorph/holon-types, which carries the shared enums, error classes, and entity types. See FAQ for how the two packages relate.
Runs on Node.js 18+, Bun, Deno, and any runtime with a global fetch. No polyfill is needed on those runtimes.
Every request carries a bearer API key, sent as the header Authorization: Bearer <apiKey>. You pass the key once when you create the client, and the client attaches it to each request.
Keys start with the holon_ prefix. Request one through the developer dashboard. Keep the key out of source control and read it from the environment.
createHolonClient takes three options.
The HOLON API base URL, for example https://holon-api.ontomorph.com. Required, type string.
Your holon_… key, sent as a bearer token. Required, type string.
Per-request timeout in milliseconds, applied via AbortSignal.timeout. Optional, type number. A request that exceeds it throws (see error handling in API-Reference).
// client.ts
import { createHolonClient } from "@ontomorph/holon-client";
export const holon = createHolonClient({
apiUrl: "https://holon-api.ontomorph.com",
apiKey: process.env.HOLON_API_KEY, // holon_…
timeout: 30_000,
});Search returns a page of hits. Read the first one.
// first-call.ts
import { holon } from "./client";
const results = await holon.concepts.search("metformin");
const top = results.hits[0];
console.log(top.conceptId); // stable numeric id
console.log(top.conceptName); // human-readable name
console.log(top.vocabularyId, top.domainId);From here, Guides walks each namespace, and Use-Cases shows four full scenarios.