Generate a Session Token

Session tokens used for authentication by DWS Viewer API can be generated either via the dashboard or through the backend API.

Token Configuration

Session tokens can be created with one or more optional claims that control their properties:

  • (Required) scope - The scope of the token. Can be either frontend or backend.
  • (Required) allowed_documents - List of document claims that the token is allowed to access. Defaults to any for backend scope which gives access to all documents. For frontend scope, you need to specify the document claims.
  • expires_in — Number of seconds until the token expires. Defaults to 86 400 for one-day expiration.
  • user_id — ID of the user that will be stored on any annotation created, updated, or deleted by the user. Defaults to null.

Documents Claims

  • (Required) document_id - ID of the document.
  • document_permissions — List of permission names that define which features will be accessible to the holder of this token. Defaults to all permissions.
  • collaboration_permissions — Defines fine-grained permissions for actions allowed by individual users when multiple users are working on the same document. See the collaboration permissions guide for more details. Defaults to all permissions.

Document Permissions

Available permissions:

  • "write" — Required for creating, updating, and deleting annotations in a document. If this permission isn’t present, PSPDFKit for Web will always be in read-only mode.
  • "download" — Required for downloading and printing a document’s PDF file.