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

# Mint an embed token

> Mint a short-lived token for one end user of your embedded analyst. Call this from your server — the API key must never reach the browser; only the returned token does. The email you send becomes the ClarityQ identity, so send only addresses your application has authenticated.



## OpenAPI

````yaml post /api/v1/products/{product_id}/embed/token
openapi: 3.1.0
info:
  title: ClarityQ API
  description: ClarityQ API, authenticated via API keys.
  version: 1.0.0
servers:
  - url: https://api.clarityq.ai
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/products/{product_id}/embed/token:
    servers:
      - url: https://app.clarityq.ai
        description: Production
    post:
      tags:
        - API
      summary: Mint an embed token
      description: >-
        Mint a short-lived token for one end user of your embedded analyst. Call
        this from your server — the API key must never reach the browser; only
        the returned token does. The email you send becomes the ClarityQ
        identity, so send only addresses your application has authenticated.
      operationId: mint_embed_token_api_v1_products__product_id__embed_token_post
      parameters:
        - name: product_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Product Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MintEmbedTokenRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MintEmbedTokenResponse'
        '401':
          description: API key missing, malformed, revoked or expired.
        '404':
          description: Product not found.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limited — mint one token per user session, not per page view.
components:
  schemas:
    MintEmbedTokenRequest:
      type: object
      title: MintEmbedTokenRequest
      required:
        - email
      properties:
        email:
          type: string
          title: Email
          pattern: ^[^@\s]+@[^@\s]+\.[^@\s]+$
          description: >-
            The end user's email — this IS the identity. It becomes an ordinary
            ClarityQ user, owning that address's conversation history.
            Lower-cased before use. Send only addresses your application has
            authenticated.
          example: jane@acme.com
        name:
          type: string
          title: Name
          description: Display name. Falls back to the email.
          example: Jane Doe
        ttl_seconds:
          type: integer
          title: Ttl Seconds
          minimum: 1
          maximum: 86400
          default: 3600
          description: >-
            Token lifetime in seconds. Tokens cannot be revoked, so this is the
            exposure window if one leaks — prefer the shortest your refresh
            handling can live with. Below 300 the refresh warning leaves your
            server little time to mint a replacement.
    MintEmbedTokenResponse:
      type: object
      title: MintEmbedTokenResponse
      required:
        - token
        - expires_in
      properties:
        token:
          type: string
          title: Token
          description: >-
            The embed JWT. Put it in the iframe URL fragment at boot, and in
            `clarityq:token` postMessages after that.
        expires_in:
          type: integer
          title: Expires In
          description: Lifetime in seconds (the ttl_seconds you sent, or 3600).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key obtained from the ClarityQ dashboard.

````