A Could not decode license key error when using a DWS API key in NutrientViewer.load() indicates a product mismatch. DWS Viewer and Web SDK use different authentication methods.

Identify your product

You have…Key formatFound in
DWS Viewer APIShort API key: dws_live_abc123...Portal → Document Web Services → API Keys
Web SDKLong license key: nX5NbnzG... (500+ chars)Portal → Manage Licenses

DWS Viewer API authentication

DWS Viewer uses session tokens, not license keys. The API key authenticates your backend to request session tokens:

// ❌ Wrong — API key is not a license key.
NutrientViewer.load({
container: "#viewer",
licenseKey: "dws_live_abc123..." // Error: Could not decode.
});
// ✅ Correct — Use a session token from your backend.
NutrientViewer.load({
container: "#viewer",
session: "<session_token_from_backend>"
});

Get a session token by calling the DWS API from your server:

Terminal window
curl -X POST "https://api.nutrient.io/viewer/sessions" \
-H "Authorization: Bearer dws_live_abc123..." \
-H "Content-Type: application/json" \
-d '{"document_url": "https://example.com/document.pdf"}'

The response contains the session token to pass to the frontend.

Web SDK authentication

Web SDK uses a license key tied to your domain:

NutrientViewer.load({
container: "#viewer",
document: "document.pdf",
licenseKey: "nX5NbnzGFzYhuWTje1LqC8hWYX1jP_WAqka..."
});

Get your license key from the Nutrient Portal(opens in a new tab) under Manage Licenses after registering your domain.

Quick reference

DWS Viewer APIWeb SDK
AuthenticationSession token (from API)License key (in code)
API key used forBackend → DWS API callsNot applicable
Document hostingNutrient cloudYour infrastructure
RenderingServer-sideClient-side (WebAssembly)
PricingUsage-basedPer-domain license

Which product do I need?

Choose DWS Viewer API if

  • Nutrient hosts and renders documents
  • Usage-based pricing works for your scale
  • Minimal infrastructure setup is preferred

Choose Web SDK if

  • Documents stay on your infrastructure
  • Client-side rendering is preferred
  • Fixed per-domain licensing fits your model

Additional resources