TypeScript SDK quickstart

import { DiligenceApiKeyCredential, createManagementClient, createProductClient } from '@diligenceid/sdk';

const API_VERSION = '2026-08-30';

const credential = new DiligenceApiKeyCredential(process.env.DILIGENCE_API_KEY!);
const endpoint = 'https://api.example.diligence.id';

const management = createManagementClient(endpoint, credential);
const product = createProductClient(endpoint, credential);

Create an organisation

const organisation = await management.management.organisations.post(
  {
    externalReference: 'quickstart-org',
    displayName: 'Quickstart Organisation',
    legalName: 'Quickstart Organisation Limited',
    countryCode: 'NZ',
  },
  { queryParameters: { apiVersion: API_VERSION } },
);

Every Management call needs apiVersion. Omitting it rejects rather than quietly reaching some default.

Pass request configuration as an object, not a callback

// Correct
await management.management.issuers.get({ queryParameters: { apiVersion: API_VERSION } });

// Silently wrong — the request goes out with api-version= empty
await management.management.issuers.get((c) => { c.queryParameters.apiVersion = API_VERSION; });

The callback form compiles and runs. What it sets is discarded, and the request reaches the service without the version, which fails with MissingApiVersionParameter for reasons that appear to have nothing to do with your code. The .NET client accepts the callback form; the TypeScript one does not. Use the object form here.

Create and read an issuer

const issuer = await management.management.issuers.post(
  { displayName: 'Quickstart Issuer', organisationReference: organisation!.properties!.reference! },
  { queryParameters: { apiVersion: API_VERSION } },
);

const issuerId = issuer!.name!;

const read = await management.management.issuers.byIssuerId(issuerId).get(
  { queryParameters: { apiVersion: API_VERSION } },
);

console.log(read!.properties!.displayName, read!.systemData!.createdAt);

Update safely

await management.management.issuers.byIssuerId(issuerId).patch(
  { displayName: 'Quickstart Issuer (renamed)' },
  {
    queryParameters: { apiVersion: API_VERSION },
    headers: { 'If-Match': read!.etag! },
  },
);

A stale tag rejects rather than overwriting. See handle concurrency.

List

const issuers = await management.management.issuers.get(
  { queryParameters: { apiVersion: API_VERSION } },
);

for (const item of issuers?.value ?? []) {
  console.log(item.issuerId, item.status);
}

nextLink is null today. Loop on it anyway.

Issue

const issuance = await product.v10.credentials.issuance.post(
  {
    issuerId,
    credentialConfiguration: 'membership-2026',
    externalSubjectReference: 'subject-1',
  },
  { headers: { 'Idempotency-Key': 'enrolment-2026-a41f9' } },
);

console.log(issuance?.data?.status);   // awaiting_wallet

awaiting_wallet is correct, not stuck.

Edit this page on GitHub