---
title: "Generate Embed Session Token"
method: POST
path: "/v1/embeds/token"
tags: ["Document Embedding"]
---

# Generate Embed Session Token

`POST /v1/embeds/token`

Generates a short-lived, limited-scope temporary access token to allow your app to display embedded Lucid documents in an iframe. The token allows the embedding website to load the document picker and document viewer, but does not grant access to any additional resource within Lucid.

## Request body

- object
  - `embedId` string, uuid — ID of the document embed. This is needed for viewing an existing embed.
  - `origin` string, required — The URL (including protocol) of the webpage that will host the embed. Must use the `https://` scheme (e.g., `https://example.com`, `http://localhost`).
  - `sessionConfig` SessionConfig
    - `products` Product[] — A list of Products that a user can choose a document from to be embedded. Defaults to all products.
    - `viewerType` object — What type of viewer to load by defaults. If not specified, defaults to rich. Users can change this later.
      - `default` 'rich' | 'simple' — - rich: The standard Lucid viewer experience. A fully interactive viewer with zoom, panning, and support for hotspots and other interactive elements. - simple: A basic Lucid viewer experience that can be used in place of the rich viewer if there are performance or load time concerns. The simple viewer renders non-interactive raster images instead of a high-fidelity vector experience and is a poorer fit for viewing larger documents.
    - `ui` 'viewer' | 'settings' — - viewer: When loading an existing embed, go directly to the standard embedded view of the document. - settings: When loading an existing embed, show the user the embed settings interface before taking them to the standard embed view of the document.
    - `customSettings` 'postMessage' | 'none' — - postMessage: Display a "Settings for <app>" link in the embed settings view where users can update the settings. When clicked, the OpenCustomSettings postMessage event would be fired so the app can display its own customized settings view. - none: "Settings for <app>" link would not be available in the settings editor.

## Response `200`

Valid token that can be used to embed a document picker or a document viewer.

## Other responses

- `400` — Bad Request. Occurs when `origin` is missing a protocol, uses an unsupported scheme, or is not a valid URL.
- `401` — Access token is missing or invalid.
- `403` — Access to the embed is forbidden.
- `404` — The embed id in the parameter is not found.

---

[API](https://skmtc.net/lucid/apis/lucid-rest-api.md) · [All operations](https://skmtc.net/lucid/apis/lucid-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lucid/lucid-rest-api/revisions/6a32cb9e1aa7/schema)
