Use the Node SDK

Install the official Node.js client and run a tool in a few lines.
Guide
Intermediate
2 min read
Updated Dec 5, 2026

The Node SDK is the official JavaScript client. Its methods and typings are generated from the same API contract as the server, so they match the API. It needs Node 18 or newer and has no runtime dependencies.

Install

npm install @davixlabs/h2i-sdk

Use it

const { DavixH2I, enums } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({
  apiKey: process.env.DAVIX_H2I_API_KEY,
  baseUrl: 'https://app.h2i.davixlabs.io',
});

const res = await h2i.images.resize({
  images: './photo.jpg',
  width: 800,
  resizeMode: enums.ResizeFit.COVER,
});
console.log(res.data, res.requestId);

What it does for you

  • Key safety: the key is sent only in the X-Api-Key header.
  • Uploads: a file can be a path, a Buffer, a Blob or File, a stream, or { data, filename, contentType }.
  • Errors: every failure is a DavixH2IError with status, code, requestId, hint, retryable and more. Compare codes with ErrorCodes.
  • Retries: only retryable errors, and only for calls that cannot do the work twice. By default the SDK makes one idempotency key per call and reuses it on every retry, so a retry never charges you twice. You can pass your own idempotencyKey or turn the automatic key off with autoIdempotencyKey: false.
  • Metadata: h2i.schema('images.resize') gives each field’s type, limits, default and allowed values. await h2i.capabilities() shows what the server offers and h2i.capabilities.account() your plan, limits and usage.
  • Escape hatch: h2i.request('POST', '/v1/…', { json }) reaches any public /v1/ path the SDK does not know yet.
  • Name your app: add app: 'My shop importer' to a call to label it in your History.

Other languages

Clients for Python, PHP, Go, Java, .NET and Ruby are published on their package registries too and are built from the same contract, so they match the API. Each guide has the install command and the package page.

Checked against the Node SDK README and the npm registry.

Was this article helpful?
Thanks for your feedback.
Still stuck?

Talk to a human

Send us a message and we will get back to you quickly.