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

# create widget session token

> Create a session token for a configured widget. The request origin must be allowed by the persona's widget configuration unless the widget is configured to allow every origin. When watermark removal is configured, the token also requests removal of the AI avatar disclosure; the engine re-checks the organization's current entitlement when the session starts.



## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/auth/widget
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Avatar Videos
  - name: Meetings
  - name: Watermark Checks
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: Pronunciation Dictionaries
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
  - name: Engine
paths:
  /v1/auth/widget:
    post:
      tags:
        - Sessions
      summary: create widget session token
      description: >-
        Create a session token for a configured widget. The request origin must
        be allowed by the persona's widget configuration unless the widget is
        configured to allow every origin. When watermark removal is configured,
        the token also requests removal of the AI avatar disclosure; the engine
        re-checks the organization's current entitlement when the session
        starts.
      operationId: createWidgetSessionToken
      parameters:
        - in: header
          name: Origin
          required: false
          schema:
            type: string
            format: uri
          description: >-
            Origin of the page hosting the widget. Required unless the widget
            allows every origin.
          example: https://customer.example
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agentId
              properties:
                agentId:
                  type: string
                  description: ID of the persona used by the widget.
                  example: 071b0286-4cce-4808-bee2-e642f1062de3
      responses:
        '200':
          description: Widget session token created.
          headers:
            Access-Control-Allow-Origin:
              schema:
                type: string
              description: Echoes the request Origin, or `*` when absent.
            Vary:
              schema:
                type: string
                example: Origin
          content:
            application/json:
              schema:
                type: object
                required:
                  - sessionToken
                properties:
                  sessionToken:
                    type: string
                    description: Short-lived token accepted by `POST /v1/engine/session`.
        '400':
          description: Invalid JSON or missing/invalid `agentId`.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                    example: Missing or invalid agentId
                  details:
                    type: object
        '403':
          description: The request Origin is not allowed by the widget configuration.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                  - origin
                properties:
                  error:
                    type: string
                    example: Origin not allowed
                  origin:
                    type: string
                    example: https://customer.example
                  hint:
                    type: string
                    example: >-
                      Add "https://customer.example" to allowed origins in
                      widget settings
        '404':
          description: Persona not found.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                    example: Agent not found
        '500':
          description: Session token creation failed.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: string
                    example: Failed to create session
      security: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.