@humanity-org/connect-sdk is the official TypeScript helper for Humanity’s Public API. It wraps the generated REST client with ergonomic helpers for OAuth, preset verification, feeds, and error handling so partner teams can ship integrations quickly.
Installation
Initialization & configuration
OAuth helpers
/oauth/authorize, /oauth/token, /oauth/revoke) and enforces the PKCE + grant-type requirements documented in the API reference.
buildAuthUrl options
Returns:
{ url: string, codeVerifier: string } — the state is NOT returned; you must pass it in and store it yourself.
TokenResult
TheexchangeCodeForToken helper returns a fully typed TokenResult:
Static security helpers
The SDK provides static methods for OAuth security parameters:Preset verification
verifyPreset,verifyPresets, andgetPresetexpose the/presets/*endpoints with fully typed responses (including evidence payloads).- Use
listPresets()to discover all available presets with their metadata. - Maximum of 10 presets per batch request; the helper enforces this before hitting the API.
PresetBatchResult
TheverifyPresets helper returns a PresetBatchResult with two arrays:
Query Engine
For declarative queries against user credentials, use the Query Engine:Dropping down to the raw client
The generatedsdk.client exposes every controller method exactly as declared in the OpenAPI. Use it whenever you need lower-level access or when rolling your own abstractions.
src/contracts), you can rely on TypeScript to catch breaking changes long before runtime.
Error handling
The SDK exports typed error classes for precise error handling:- Rate limits follow the guidance in Environments & tooling. Honor
Retry-Afterheaders and reuseidempotency_keyvalues when retrying POSTs. - If you lose track of the SDK abstraction, call
sdk.clientdirectly—both layers share the same authentication headers and transport pipeline.