The Platform SDK can be installed using two primary methods: CDN and NPM.
Load the latest v2 via a package manager:
npm install @transmitsecurity/platform-web-sdk@^2Depending on your tasks, import one or several modules, and then initialize them. Using individual module imports (e.g., @transmitsecurity/platform-web-sdk/drs) instead of the full SDK import helps reduce your bundle size. This dramatically improves page load times and user experience.
You can import and use the Platform SDK in different ways, depending on your needs:
- Import specific functions from individual subpaths (recommended): Ideal when you need only a few SDK features. It includes only the functions you import, requires no initialization, and keeps the bundle small—great for faster load times and better performance on mobile or slow networks.
- Import individual modules: Best for most use cases. It supports tree-shaking to exclude unused modules and keeps overhead low, balancing flexibility and performance.
- Import multiple modules: Use this if you need to configure modules separately or support legacy code. Tree-shaking is less effective, and some modules must be instantiated, which increases bundle size.
Use this approach when you only need a few specific SDK functions and want the smallest possible bundle.
The functions shown are examples only. For the full list of functions in each module, see that module’s SDK reference.
// Import Orchestration functions
import {
startJourney,
initialize,
} from '@transmitsecurity/platform-web-sdk/ido';
// Initialize SDK
initialize({
clientId: 'your-client-id',
ido: {
serverPath: 'https://api.transmitsecurity.io/ido' // Required: Set serverPath based on your region or custom domain
}
});
// Example usage after initialization
await startJourney('JOURNEY_ID');The SDK modules can be configured to work with a different region by setting serverPath for each module individually. If you're using a custom domain for your application, replace the Transmit domain (api.transmitsecurity.io) with your custom domain in each serverPath (for example, https://your-domain.com/ido instead of https://api.transmitsecurity.io/ido). For the SDK to work properly, the regions must match.
Use this when you need an entire modules with minimal overhead. For example:
// Import Orchestration module
import * as ido from '@transmitsecurity/platform-web-sdk/ido';
// Initialize SDK
ido.initialize({
clientId: 'your-client-id',
ido: {
serverPath: 'https://api.transmitsecurity.io/ido' // Required: Set serverPath based on your region or custom domain
}
});
// Example usage after initialization
await ido.startJourney('JOURNEY_ID');The SDK modules can be configured to work with a different region by setting serverPath for each module individually. If you're using a custom domain for your application, replace the default Transmit domain (api.transmitsecurity.io) with your custom domain in each serverPath (for example, https://your-domain.com/ido instead of https://api.transmitsecurity.io/ido). For the SDK to work properly, the regions must match.
Use this when you want to use several modules or are maintaining existing code that uses class-based SDK instances. Tree-shaking removes any unused modules after a single initialize() call.
// Import initialize function and modules from root
// Import only the modules you need
import { initialize, ido, drs, idv, webauthn } from '@transmitsecurity/platform-web-sdk';
// Initialize SDK
// Initialize only the modules you need
initialize({
clientId: 'your-client-id',
drs: {
serverPath: 'https://api.transmitsecurity.io/risk-collect/' // Required: Set serverPath based on your region or custom domain
},
ido: {
serverPath: 'https://api.transmitsecurity.io/ido' // Required: Set serverPath based on your region or custom domain
},
idv: {
serverPath: 'https://api.transmitsecurity.io/verify' // Required: Set serverPath based on your region or custom domain
},
webauthn: {
serverPath: 'https://api.transmitsecurity.io' // Required: Set serverPath based on your region or custom domain
}
});
// Example usage after initialization
await ido.startJourney('JOURNEY_ID');
await drs.triggerActionEvent('login', { correlationId: 'id', claimedUserId: 'claimed_user_id' });
await idv.start(startToken);
await webauthn.authenticate.modal('USERNAME');- When using multiple modules, always use a single
initializecall. - The SDK modules can be configured to work with a different region by setting
serverPathfor each module individually. If you're using a custom domain for your application, replace the Transmit domain (api.transmitsecurity.io) with your custom domain in eachserverPath(for example,https://your-domain.com/idoinstead ofhttps://api.transmitsecurity.io/ido). For the SDK to work properly, the regions must match.
CDN installation is recommended for rapid prototying and testing. Load the SDK directly via CDN by adding the following HTML <script> tag in all relevant pages:
<!-- Load the latest SDK -->
<script src="https://platform-websdk.transmitsecurity.io/platform-websdk/2.x/ts-platform-websdk.js" defer="true" id="ts-platform-script"></script>Wait for the SDK to load before using it:
document.getElementById('ts-platform-script').addEventListener('load', () => {
// SDK is ready - initialize
// Invoke functions inside 'window.tsPlatform'
window.tsPlatform.initialize({
clientId: 'your-client-id',
drs: {
serverPath: 'https://api.transmitsecurity.io/risk-collect/' // Required: Set serverPath based on your region or custom domain
},
ido: {
serverPath: 'https://api.transmitsecurity.io/ido' // Required: Set serverPath based on your region or custom domain
},
idv: {
serverPath: 'https://api.transmitsecurity.io/verify' // Required: Set serverPath based on your region or custom domain
},
webauthn: {
serverPath: 'https://api.transmitsecurity.io' // Required: Set serverPath based on your region or custom domain
}
});
});The SDK modules can be configured to work with a different region or a custom domain by setting serverPath for each module individually. For the SDK to work properly, the regions must match.