> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scanova.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Issue a draft preview token

> POST /qr/{qrid}/preview-token/

Issues a short-lived token that lets the landing app render this QR Code's **unpublished draft** without a login — the "Preview" button in the editor.

```
POST   https://api.scanova.io/qr/{qrid}/preview-token/
Authorization: 401f7ac837da42b97f613d789819ff93537bee6a
```

<ParamField path="qrid" type="string" required>
  The QR Code's `qrid`.
</ParamField>

Takes no request body.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.scanova.io/qr/Qa1b2c3d4e5f6g7h8/preview-token/" \
    -H "Authorization: 401f7ac837da42b97f613d789819ff93537bee6a"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "complete_url": "https://scnv.io/a1b2c3d4"
  }
  ```
</ResponseExample>

<Warning>
  The token is a JWT with a short lifetime — about **3600 seconds** by default. Mint it when the user opens a preview, not ahead of time, and never embed it in anything long-lived: anyone holding it can read the unpublished draft.
</Warning>

A QR Code that has no `url_hash` yet returns `400` — there is no URL to preview against until one is assigned.

## Related

* [Create a QR Code](/api-reference/management-api/qr/create) — the draft state machine this previews.
* [Update a QR Code](/api-reference/management-api/qr/update) — save a draft, then preview it, then publish.
* [Change a QR Code's short-URL slug](/api-reference/management-api/qr/url-hash-update) — assign the `url_hash` this endpoint requires.
* [QR Manager overview](/api-reference/management-api/qr/overview) — the quotas, role permissions, and Trash model shared by every endpoint in this module.
* [Management API overview](/api-reference/management-api/overview) — the auth scheme and quota rules that apply to this endpoint.


## OpenAPI

````yaml api-reference/openapi/management-api.json POST /qr/{qrid}/preview-token/
openapi: 3.1.0
info:
  title: Scanova Management API (v2)
  description: >-
    The complete Scanova Management API — every endpoint available at
    api.scanova.io (QR codes, folders, tags, leads, forms, analytics, plans,
    shared users & roles), plus the token-creation and usage-stats endpoints
    used to authenticate against it. Every path and request/response shape below
    was verified live against a real API key and the actual running backend
    (Phase 7, 2026-08-16) — not guessed from reading urls.py alone.
  version: 2.0.0
servers:
  - url: https://api.scanova.io
    description: Management API — QR/folder/tag/lead/form/analytics/plans endpoints
security:
  - apiKeyAuth: []
paths:
  /qr/{qrid}/preview-token/:
    post:
      summary: Issue a short-lived draft preview token
      description: >-
        Issues a short-lived JWT (default TTL about 3600 seconds) that lets the
        landing app render this QR code's unpublished draft without a login.
        Takes no body. Refused with 400 if the QR code has no url_hash yet.
      operationId: createQrPreviewToken
      parameters:
        - name: qrid
          in: path
          required: true
          schema:
            type: string
          description: >-
            The QR code's `qrid` — the opaque public identifier returned by the
            list endpoint, not the numeric `id`.
      responses:
        '200':
          description: A preview token and the URL to use it against.
          content:
            application/json:
              example:
                token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
                complete_url: https://scnv.io/a1b2c3d4
        '400':
          description: The QR code has no `url_hash` yet, so there is no URL to preview.
        '404':
          description: No QR code with this `qrid` owned by this account.
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your Management API key as the raw value of the Authorization
        header — no "Bearer " or "Token " prefix, and no other characters.
        Example: `Authorization: 401f7ac837da42b97f613d789819ff93537bee6a`. A
        header containing more than one space-separated part is rejected
        outright. Requests also require the request's Host header to be the
        management API host (e.g. api.scanova.io) — the same key sent to the
        regular API host will not authenticate.

````