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

# Get User's Embed Token

> Get the current compact embed token for a user. Specify organization_id for an organization-scoped viewer. The parameter is required whenever the user has more than one eligible organization context. The iframe exchanges this compact token for a short-lived bearer automatically.




## OpenAPI

````yaml /openapi.yaml get /users/{external_id}/embed-token
openapi: 3.0.0
info:
  title: Answering Agent API
  description: API for Answering Agent platform
  version: 1.0.0
servers:
  - url: https://answeringagent.com/api/v1
    description: Production API
  - url: https://playground.answeringagent.com/api/v1
    description: Playground API
security: []
paths:
  /users/{external_id}/embed-token:
    get:
      tags:
        - Embed Tokens
      summary: Get User's Embed Token
      description: >
        Get the current compact embed token for a user. Specify organization_id
        for an organization-scoped viewer. The parameter is required whenever
        the user has more than one eligible organization context. The iframe
        exchanges this compact token for a short-lived bearer automatically.
      operationId: getUserEmbedToken
      parameters:
        - in: path
          name: external_id
          required: true
          schema:
            type: string
          description: The external ID of the user
        - $ref: '#/components/parameters/EmbedOrganizationId'
      responses:
        '200':
          description: Embed token retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  embed_token:
                    type: string
                    description: The user's current embed token (URL-safe, compact format)
                    example: MTIzNDV8ZDgyZDk3Mzg1OTAxNTkzNA
                  user_id:
                    type: string
                    description: The external ID of the user
                    example: customer_123
                  organization_id:
                    type: integer
                    nullable: true
                    description: Present for an organization-scoped viewer token
                    example: 123
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: User not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: User not found
        '422':
          $ref: '#/components/responses/ValidationError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    EmbedOrganizationId:
      in: query
      name: organization_id
      required: false
      schema:
        type: integer
        minimum: 1
      description: >
        Selects one organization context. Required when the user can access more
        than one eligible context, and recommended for every scoped viewer
        request.
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: API key is required
                enum:
                  - API key is required
                  - Invalid credentials
    ValidationError:
      description: Validation failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
              errors:
                type: object
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````