---
title: "Web SDK vs. DWS Viewer API: Which key do I use?"
canonical_url: "https://www.nutrient.io/guides/web/knowledge-base/web-sdk-vs-dws-viewer/"
md_url: "https://www.nutrient.io/guides/web/knowledge-base/web-sdk-vs-dws-viewer.md"
last_updated: "2026-06-10T21:35:04.317Z"
description: "Resolve 'Could not decode license key' errors by understanding the difference between Web SDK license keys and DWS Viewer API session tokens."
---

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

## Identify your product

| You have...        | Key format                                   | Found in                                  |
| ------------------ | -------------------------------------------- | ----------------------------------------- |
| **DWS Viewer API** | Short API key: `dws_live_abc123...`          | Portal → Document Web Services → API Keys |
| **Web SDK**        | Long license key: `nX5NbnzG...` (500+ chars) | Portal → Manage Licenses                  |

## DWS Viewer API authentication

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

```javascript

// ❌ 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:

```bash

curl -X POST "https://api.nutrient.io/viewer/sessions" \
  -H "Authorization: Bearer dws_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{"allowed_documents":[{"document_id":"<document_id>","permissions":["read"]}]}'

```

For app-provided documents, omit `allowed_documents` instead:

```bash

curl -X POST "https://api.nutrient.io/viewer/sessions" \
  -H "Authorization: Bearer dws_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{}'

```

The response contains the session token to pass to the frontend. Do not pass your DWS API key to `NutrientViewer.load()`.

## Web SDK authentication

Web SDK uses a **license key** tied to your domain:

```javascript

NutrientViewer.load({
  container: "#viewer",

  document: "document.pdf",
  licenseKey: "nX5NbnzGFzYhuWTje1LqC8hWYX1jP_WAqka..."
});

```

Get your license key from the [Nutrient Portal](https://my.nutrient.io/) under **Manage Licenses** after registering your domain.

## Quick reference

|                      | DWS Viewer API                                  | Web SDK               |
| -------------------- | ----------------------------------------------- | --------------------- |
| **Authentication**   | Session token (from API)                        | License key (in code) |
| **API key used for** | Backend → DWS API calls                         | Not applicable        |
| **Document source**  | DWS-managed documents or app-provided documents | Your infrastructure   |
| **Rendering**        | DWS Viewer API + Web SDK                        | Client-side Web SDK   |
| **Pricing**          | Usage-based                                     | Per-domain license    |

## Which product do I need?

**Choose DWS Viewer API if**

- You want DWS to manage documents for you

- You want DWS Viewer API session authorization for app-provided documents

- Usage-based pricing works for your scale

- You don’t want to run Document Engine yourself

**Choose Web SDK if**

- Documents stay on your infrastructure

- Client-side rendering is preferred

- Fixed per-domain licensing fits your model

## Additional resources

- [DWS Viewer API documentation](https://www.nutrient.io/api/viewer-api/) — Session tokens and API reference

- [Open PDFs using DWS Viewer API](https://www.nutrient.io/guides/web/open-a-document/from-dws-viewer-api.md) — Frontend integration guide

- [Web SDK licensing](https://www.nutrient.io/guides/web/pspdfkit-for-web/licensing.md) — Domain registration and license keys

- [Ways to use Web SDK](https://www.nutrient.io/guides/web/about/operational-modes.md) — Web SDK deployment options
---

## Related pages

- [Add Listener Toolbar Item](/guides/web/knowledge-base/add-listener-toolbar-item.md)
- [Add Listener Text Note Annotation](/guides/web/knowledge-base/add-listener-text-note-annotation.md)
- [Add Custom Keyboard Shortcuts](/guides/web/knowledge-base/add-custom-keyboard-shortcuts.md)
- [Add Signature Initials](/guides/web/knowledge-base/add-signature-initials.md)
- [How to add a custom toolbar item to display current zoom percentage](/guides/web/knowledge-base/add-custom-zoom-perentage.md)
- [Check Password Protected Files](/guides/web/knowledge-base/check-password-protected-files.md)
- [Listen to an annotation’s hover event](/guides/web/knowledge-base/annotations-hover-event.md)
- [Change Default Line Width Ink Annotations](/guides/web/knowledge-base/change-default-line-width-ink-annotations.md)
- [Automatic Annotation Field Tab Ordering](/guides/web/knowledge-base/automatic-annotation-field-tab-ordering.md)
- [Blurry Print Resolution](/guides/web/knowledge-base/blurry-print-resolution.md)
- [Check Document Contains Annotations](/guides/web/knowledge-base/check-document-contains-annotations.md)
- [Keep widget annotation dimensions consistent across devices](/guides/web/knowledge-base/consistent-widget-annotation-dimensions.md)
- [Disable Context Menu](/guides/web/knowledge-base/disable-context-menu.md)
- [Create Highlight Annotations From Text Extraction Technology](/guides/web/knowledge-base/create-highlight-annotations-from-text-extraction-technology.md)
- [Control Appearance Of Delete Button On Ink Annotations](/guides/web/knowledge-base/control-appearance-of-delete-button-on-ink-annotations.md)
- [Customize Page Indicator](/guides/web/knowledge-base/customize-page-indicator.md)
- [Deselect Text](/guides/web/knowledge-base/deselect-text.md)
- [Default To Cloudy Border](/guides/web/knowledge-base/default-to-cloudy-border.md)
- [Delete All Annotations](/guides/web/knowledge-base/delete-all-annotations.md)
- [Determine Current Layout Mode](/guides/web/knowledge-base/determine-current-layout-mode.md)
- [Detect Pspdfkit Ui Loaded](/guides/web/knowledge-base/detect-pspdfkit-ui-loaded.md)
- [Disable Resize Of Annotations](/guides/web/knowledge-base/disable-resize-of-annotations.md)
- [How to disable text annotation movement in web apps](/guides/web/knowledge-base/disable-text-annotation-movement.md)
- [Export Ink Annotation Image](/guides/web/knowledge-base/export-ink-annotation-image.md)
- [Focus the delete button in a confirm dialog](/guides/web/knowledge-base/focus-delete-button-in-confirm-modal-component.md)
- [Download Exported Document](/guides/web/knowledge-base/download-exported-document.md)
- [Extracting text and cursor position in annotations](/guides/web/knowledge-base/extract-annotation-text-and-retrieve-cursor-position.md)
- [Find Ink Annotation For Signature Form Field](/guides/web/knowledge-base/find-ink-annotation-for-signature-form-field.md)
- [Focus Viewer After Loading](/guides/web/knowledge-base/focus-viewer-after-loading.md)
- [Get Entered Document Password](/guides/web/knowledge-base/get-entered-document-password.md)
- [Fix errors with unsupported form field actions](/guides/web/knowledge-base/handle-unsupported-form-field-actions.md)
- [Focus Widget Annotation](/guides/web/knowledge-base/focus-widget-annotation.md)
- [Get Visible Annotations](/guides/web/knowledge-base/get-visible-annotations.md)
- [Handling Clicks On Custom Overlays](/guides/web/knowledge-base/handling-clicks-on-custom-overlays.md)
- [How Do I Toggle The Theme](/guides/web/knowledge-base/how-do-i-toggle-the-theme.md)
- [Highlight required form fields](/guides/web/knowledge-base/highlight-required-fields.md)
- [How Do I Disable Scrolling On Page Edges](/guides/web/knowledge-base/how-do-i-disable-scrolling-on-page-edges.md)
- [How Do I Limit The Number Of Annotations](/guides/web/knowledge-base/how-do-i-limit-the-number-of-annotations.md)
- [How Do I Prevent Printing Annotations](/guides/web/knowledge-base/how-do-i-prevent-printing-annotations.md)
- [Resize multiline text fields to avoid overflow](/guides/web/knowledge-base/how-do-i-resize-form-fields.md)
- [How Do I Rotate A Page](/guides/web/knowledge-base/how-do-i-rotate-a-page.md)
- [How Do I Zoom To A Specific Value](/guides/web/knowledge-base/how-do-i-zoom-to-a-specific-value.md)
- [How To Create Bookmarks From Outline Elements](/guides/web/knowledge-base/how-to-create-bookmarks-from-outline-elements.md)
- [Load Pdf As Arraybuffer](/guides/web/knowledge-base/load-pdf-as-arraybuffer.md)
- [Image Attachments Lost Stamp Annotation Templates](/guides/web/knowledge-base/image-attachments-lost-stamp-annotation-templates.md)
- [License Registered Different Bundle Id](/guides/web/knowledge-base/license-registered-different-bundle-id.md)
- [Iterate over form fields and widgets](/guides/web/knowledge-base/iterate-over-form-fields.md)
- [Link Text](/guides/web/knowledge-base/link-text.md)
- [Loading Multiple Files](/guides/web/knowledge-base/loading-multiple-files.md)
- [Load Pdf From Stream](/guides/web/knowledge-base/load-pdf-from-stream.md)
- [Persist Ink Signatures Across Instances](/guides/web/knowledge-base/persist-ink-signatures-across-instances.md)
- [Load Pdf Stub From String](/guides/web/knowledge-base/load-pdf-stub-from-string.md)
- [Nutrient Size Optimization](/guides/web/knowledge-base/nutrient-size-optimization.md)
- [Disabling automatic synchronization in Nutrient Web SDK](/guides/web/knowledge-base/manual-instant-sync.md)
- [Override User Agent](/guides/web/knowledge-base/override-user-agent.md)
- [Observe Document Editor Visibility](/guides/web/knowledge-base/observe-document-editor-visibility.md)
- [Overview](/guides/web/knowledge-base/overview.md)
- [Override Ink Signature Dialog](/guides/web/knowledge-base/override-ink-signature-dialog.md)
- [Persist Currently Edited Note Test](/guides/web/knowledge-base/persist-currently-edited-note-test.md)
- [Place Annotation At Visible Center](/guides/web/knowledge-base/place-annotation-at-visible-center.md)
- [Prevent Editing Content Text Annotation](/guides/web/knowledge-base/prevent-editing-content-text-annotation.md)
- [Render Document Full Height](/guides/web/knowledge-base/render-document-full-height.md)
- [Prevent Shortcut Printing](/guides/web/knowledge-base/prevent-shortcut-printing.md)
- [Process Currently Rendered Pages](/guides/web/knowledge-base/process-currently-rendered-pages.md)
- [Programmatic Comment Annotations](/guides/web/knowledge-base/programmatic-comment-annotations.md)
- [Programmatically Navigate To Page](/guides/web/knowledge-base/programmatically-navigate-to-page.md)
- [Read-only forms](/guides/web/knowledge-base/read-only-forms.md)
- [Render Night Mode](/guides/web/knowledge-base/render-night-mode.md)
- [Render Page Black White](/guides/web/knowledge-base/render-page-black-white.md)
- [Render Page Without Annotations](/guides/web/knowledge-base/render-page-without-annotations.md)
- [Render Visible Area In Current Page](/guides/web/knowledge-base/render-visible-area-in-current-page.md)
- [Render Watermark When Printing](/guides/web/knowledge-base/render-watermark-when-printing.md)
- [Rotate Ink Annotation](/guides/web/knowledge-base/rotate-ink-annotation.md)
- [Submit Ink Signatures With Form](/guides/web/knowledge-base/submit-ink-signatures-with-form.md)
- [Show Annotations Properties As Tooltip](/guides/web/knowledge-base/show-annotations-properties-as-tooltip.md)
- [Restore Last Seen Page](/guides/web/knowledge-base/restore-last-seen-page.md)
- [Show Focus Ring Read Only](/guides/web/knowledge-base/show-focus-ring-read-only.md)
- [Save Modified Pdf To Document Engine](/guides/web/knowledge-base/save-modified-pdf-to-document-engine.md)
- [Wait For Element Appear](/guides/web/knowledge-base/wait-for-element-appear.md)
- [Easily zoom to specific annotations in PDF](/guides/web/knowledge-base/zoom-to-specific-annotation.md)

