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

# Get impersonation credentials for a user

> Issue an impersonation token that lets a SUPERADMIN (or ADMIN within their own organization) sign in as the target user via /api/auth/login. Also returns the caller's original-admin token so the impersonated session can later be exited via /api/auth/exit-impersonation.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/auth/impersonate/{userId}
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/auth/impersonate/{userId}:
    get:
      tags:
        - Auth
      summary: Get impersonation credentials for a user
      description: >-
        Issue an impersonation token that lets a SUPERADMIN (or ADMIN within
        their own organization) sign in as the target user via /api/auth/login.
        Also returns the caller's original-admin token so the impersonated
        session can later be exited via /api/auth/exit-impersonation.
      operationId: get_auth_impersonate_user
      parameters:
        - in: path
          name: userId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Impersonation credentials returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthImpersonateCredentialsResponse'
        '400':
          description: User ID is required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '403':
          description: Caller is not allowed to impersonate this user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '500':
          description: Failed to get impersonation credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    AuthImpersonateCredentialsResponse:
      type: object
      properties:
        email:
          type: string
          format: email
        impersonationToken:
          type: string
        fullName:
          type: string
        originalAdmin:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/AuthOriginalAdmin'
      required:
        - email
        - impersonationToken
      additionalProperties: true
      example:
        email: sam.patel@acme.example
        impersonationToken: imp_5f7b1c2e8a1d4e0012c3b4a5e6f7a8b9c0d1e2f3a4b5c6d7e8
        fullName: Sam Patel
        originalAdmin:
          id: 5f7b1c2e8a1d4e0012c3b4a5
          email: admin@acme.example
          fullName: Acme Admin
          organizationId: 5f7b1c2e8a1d4e0012c3b4a5
          accessRole: ADMIN
          token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Zjdi...
    AuthErrorResponse:
      type: object
      description: >-
        Generic error envelope returned by Auth endpoints. Most paths include
        only `error`; a few add `details`/`code` for diagnostic context.
      properties:
        error:
          type: string
        details:
          type: string
        code:
          type: string
      required:
        - error
      additionalProperties: true
      example:
        error: Invalid or expired token
        code: TOKEN_EXPIRED
    AuthOriginalAdmin:
      type: object
      description: >-
        Original admin payload returned alongside an impersonation token so the
        SPA can later restore the admin session via
        /api/auth/exit-impersonation.
      properties:
        id:
          type: string
        email:
          type: string
          format: email
        fullName:
          type: string
        organizationId:
          type: string
        accessRole:
          type: string
        conversationOpenPreference:
          type: string
        token:
          type: string
          nullable: true
          description: Token to restore admin session
      additionalProperties: true
      example:
        id: 5f7b1c2e8a1d4e0012c3b4a5
        email: admin@acme.example
        fullName: Acme Admin
        organizationId: 5f7b1c2e8a1d4e0012c3b4a5
        accessRole: ADMIN
        conversationOpenPreference: split
        token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Zjdi...
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````