TypeScript SDK reference
@extractit/sdk (source sdk/typescript/src). See SDKs for the guide and the
examples; the generated type reference (typedoc) is not part of this build yet.
// SPDX-License-Identifier: Apache-2.0
// expect: api_key
// Who am I, with fetch (Node 22+: node --experimental-strip-types whoami.ts).
const base = process.env.DX_BASE_URL;
const response = await fetch(`${base}/v1/me`, {
headers: { Authorization: `Bearer ${process.env.DX_API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const me = (await response.json()) as { type: string; scopes: string[] };
console.log(me.type, me.scopes.join(","));