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

# Mints a short-lived token for authorizing an embedded chat session.

> Used for Agents with an embed deployment and secure token mode enabled. Use this endpoint from your backend after authenticating your user. Return the token to your frontend for iframe embeds or modal initialization. [Learn more here](https://docs.cassidyai.com/agents/deploy/embed#restrict-access-with-secure-tokens).



## OpenAPI

````yaml https://app.cassidyai.com/api/openapi.json post /assistants/embed/token/create
openapi: 3.1.1
info:
  title: Cassidy Agents API
  description: >-
    Chat with your Cassidy Agents from your own apps: start chats, send
    messages, and read chat history.
  version: 1.0.0
servers:
  - url: https://app.cassidyai.com/api
security: []
tags:
  - name: Agents
externalDocs:
  url: https://docs.cassidyai.com/reference/agents-api
paths:
  /assistants/embed/token/create:
    post:
      tags:
        - Agents
      summary: Mints a short-lived token for authorizing an embedded chat session.
      description: >-
        Used for Agents with an embed deployment and secure token mode enabled.
        Use this endpoint from your backend after authenticating your user.
        Return the token to your frontend for iframe embeds or modal
        initialization. [Learn more
        here](https://docs.cassidyai.com/agents/deploy/embed#restrict-access-with-secure-tokens).
      operationId: assistantApiRouter-createEmbedDeployAuthToken
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                deployment_key:
                  type: string
                expires_in_seconds:
                  description: >-
                    Token lifetime. Defaults to and is capped at 3600 seconds;
                    `expires_at` reports the actual expiry.
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
              required:
                - deployment_key
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  token:
                    type: string
                  expires_at:
                    type: string
                required:
                  - token
                  - expires_at
                additionalProperties: false
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - bearerAuth: []
components:
  schemas:
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Authorization not provided
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
    error.FORBIDDEN:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Insufficient access
        code:
          type: string
          description: The error code
          example: FORBIDDEN
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An API key from Organization Settings > API Keys.

````

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