DecentroHR
SDK

One client, the whole API.

A fully-typed TypeScript client for every DecentroHR action.

@decentrohr/sdk is the official, fully-typed client. It ships zero runtime dependencies and covers every action — the action argument autocompletes to all 255, with per-action input and result types generated from the live API.

Install

shellDecentroHR
npm install @decentrohr/sdk

Quick start

payroll.tsDecentroHR
import { DecentroHR } from "@decentrohr/sdk";

const dhr = new DecentroHR({
  baseUrl: "https://api.decentrohr.com",
  token: process.env.DECENTROHR_TOKEN!,
});

const run = await dhr.payroll.createRun({ companyId, periodStart, periodEnd });
await dhr.payroll.calculate({ runId: run.id });
await dhr.payroll.finalize({ runId: run.id }, { idempotencyKey: `finalize:${run.id}` });

Every action, typed

Beyond the payroll helpers, call() reaches any action with full typing:

call any actionDecentroHR
const emp = await dhr.call("employee.create", { firstName, lastName, email });
const runs = await dhr.call("payroll.listRuns", { companyId });

Errors

Non-2xx responses throw a typed DecentroApiError with helpers like isEntitlement (402), isForbidden (403) and isIdempotencyConflict (409).

Idempotency & sandbox

Pass { idempotencyKey } on any mutating call; construct the client with { sandbox: true } to run against test data. The package also ships the OpenAPI contract so you can generate exact types for your own tooling.

The SDK is the same contract the DecentroHR AI calls — nothing is bolted on for partners.