Skip to main content

Prerequisites

Installation

The SDK ships as an ESM-only package with bundled .d.ts types. It runs in Node ≥ 22, modern browsers (CORS permitting), and edge runtimes (Cloudflare Workers, Vercel Edge).

Quick Start

Errors Are Return Values, Not Exceptions

Every SDK method returns a discriminated { data, error, meta, headers } union. The SDK never throws on network or API errors - narrow with if (error) ... and TypeScript will type data correctly in the success branch.
See Error Handling for the full pattern.

Configuration

You can also set your API key via environment variable:
OptionEnv varDefault
apiKey (1st arg)OMOPHUB_API_KEY- (required)
baseUrlOMOPHUB_API_URLhttps://api.omophub.com/v1
timeoutMs-30000 (set to 0 to disable)
maxRetries-3 (set to 0 to disable)
vocabVersion-unset (server picks latest)
userAgent-omophub-node/<version>
fetch-globalThis.fetch

Retries

The client automatically retries 429, 502, 503, 504, and transient network errors with full-jitter exponential backoff (500 ms → 8 s, capped). Retry-After is honoured up to 60 s. POST and PATCH only retry when an Idempotency-Key is set - pass it via { idempotencyKey: '...' } to opt in.

Next Steps

Concepts

Get, batch, and explore concepts

Search

Keyword, semantic, autocomplete

Mappings

Map between vocabularies

Error Handling

Discriminated errors, retries, async iterators