TypeScript SDK
Install and start using the TypeScript SDK.
Intro
The Decionis APIs SDK provides access to the Decionis APIs REST APIs.
Decionis evaluates captured execution intent against versioned policies before the caller performs the action. SDKs delegate policy judgment to this service and locally enforce the signed decision. New SDK API keys can be associated with an industry so Decionis provisions a starter encoded policy binding server-side; applications do not receive or implement policy logic., Ask a user's Shield for authority before an application or AI agent spends money.
Applications MUST request authorization before executing the consequential action. ALLOW authorizes only the exact request evaluated. ASK means hold until approval is complete. BLOCK means do not execute. A transport or API error is never permission.
Sandbox responses are simulations labelled sandbox_fixture and cannot move money.
Installation
The SDK compiles to dist/ before it can be referenced — run its build script once in the SDK folder, then add it to your project by path:
npm install <path-to-sdk>Quick Start
Create one client and reuse it. Configure its behaviour through ClientOptions.
import { DecionisApIsClient } from "decionis-apis";
const client = new DecionisApIsClient({
apiKeyAuth: "YOUR_BEARER_TOKEN",
operatorEntraAuth: "YOUR_BEARER_TOKEN",
accountSessionCookie: "YOUR_API_KEY",
hostedGatewayTcpRouteCredential: "YOUR_BEARER_TOKEN",
hostedGatewayTcpBrokerAuth: "YOUR_BEARER_TOKEN",
hostedGatewayWorkerAuth: "YOUR_BEARER_TOKEN",
protocolServiceAuth: "YOUR_BEARER_TOKEN",
commerceAccountsOAuth: "YOUR_BEARER_TOKEN",
commerceConnectedTransport: "YOUR_BEARER_TOKEN",
accountsWorkspaceCredentialService: "YOUR_BEARER_TOKEN",
accountsNativeEnrollmentService: "YOUR_BEARER_TOKEN",
drupalSiteKey: "YOUR_BEARER_TOKEN",
});Nothing in ClientOptions is required — new DecionisApIsClient() compiles — and each option left out falls back to its default. This API declares one environment, so there is no environment to select and no host to state at the construction site.
From CommonJS
The package ships both dialects from a single entry, so require works with full types. In a TypeScript CommonJS file use the import ... = require(...) form — a plain destructuring require runs fine but gives you any.
import sdk = require("decionis-apis");
const client = new sdk.DecionisApIsClient({
apiKeyAuth: "YOUR_BEARER_TOKEN",
operatorEntraAuth: "YOUR_BEARER_TOKEN",
accountSessionCookie: "YOUR_API_KEY",
hostedGatewayTcpRouteCredential: "YOUR_BEARER_TOKEN",
hostedGatewayTcpBrokerAuth: "YOUR_BEARER_TOKEN",
hostedGatewayWorkerAuth: "YOUR_BEARER_TOKEN",
protocolServiceAuth: "YOUR_BEARER_TOKEN",
commerceAccountsOAuth: "YOUR_BEARER_TOKEN",
commerceConnectedTransport: "YOUR_BEARER_TOKEN",
accountsWorkspaceCredentialService: "YOUR_BEARER_TOKEN",
accountsNativeEnrollmentService: "YOUR_BEARER_TOKEN",
drupalSiteKey: "YOUR_BEARER_TOKEN",
});
