> ## 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.

# Login with password or impersonation token

> Authenticate a user with email + password or with an impersonation token issued by /api/auth/impersonate/{userId}. On success returns an access token, a refresh token, the user payload, and the resolved session config.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/auth/login
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/login:
    post:
      tags:
        - Auth
      summary: Login with password or impersonation token
      description: >-
        Authenticate a user with email + password or with an impersonation token
        issued by /api/auth/impersonate/{userId}. On success returns an access
        token, a refresh token, the user payload, and the resolved session
        config.
      operationId: post_auth_login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthLoginRequest'
      responses:
        '200':
          description: Login successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthLoginResponse'
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '403':
          description: Account disabled or password auth disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
        '404':
          description: User not found (returned as invalid-credentials for security)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthErrorResponse'
components:
  schemas:
    AuthLoginRequest:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Login email; used to look up the user before credential check.
        password:
          type: string
          description: >-
            Plain-text password; verified via WorkOS when the user is migrated,
            otherwise via the local bcrypt hash. Mutually exclusive with
            `impersonationToken`.
        impersonationToken:
          type: string
          description: >-
            Single-use JWT issued by `/api/auth/impersonate/{userId}`; must
            carry the `isImpersonation` flag and match `email`. Mutually
            exclusive with `password`.
      required:
        - email
      description: Provide either password or impersonationToken with email.
      additionalProperties: false
      example:
        email: ops@acme.example
        password: CorrectHorseBatteryStaple!
    AuthLoginResponse:
      type: object
      description: >-
        Returned by `/api/auth/login` and `POST /api/auth/workos/callback` on
        success. Contains access + refresh tokens, session config, and the
        resolved user.
      properties:
        token:
          type: string
          description: JWT access token.
        refreshToken:
          type: string
        sessionConfig:
          $ref: '#/components/schemas/AuthSessionConfig'
        user:
          $ref: '#/components/schemas/AuthUserSummary'
      required:
        - token
        - refreshToken
        - sessionConfig
        - user
      additionalProperties: true
      example:
        token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1Zjdi...
        refreshToken: rt_64d2f9c5e8a1d4e001a0b1c2e6f7a8b9
        sessionConfig:
          enabled: true
          idleTimeoutMinutes: 30
          tokenExpiryHours: 8
          warningTimeMinutes: 2
        user:
          id: 5f7b1c2e8a1d4e0012c3b4a5
          email: admin@acme.example
          fullName: Acme Admin
          organizationId: 64a1b2c3d4e5f60012345678
          accessRole: ADMIN
    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
    AuthSessionConfig:
      type: object
      description: >-
        Resolved session configuration returned alongside tokens. Mirrors the
        org-level idle-timeout / SSO renewal policy so the client can enforce
        it.
      properties:
        enabled:
          type: boolean
        idleTimeoutMinutes:
          type: number
        tokenExpiryHours:
          type: number
        warningTimeMinutes:
          type: number
        idleTrackingEnabled:
          type: boolean
        ssoSilentRenewalEnabled:
          type: boolean
        ssoFallbackBehavior:
          type: string
        passwordSilentRenewalEnabled:
          type: boolean
        passwordFallbackBehavior:
          type: string
      required:
        - enabled
      additionalProperties: true
      example:
        enabled: true
        idleTimeoutMinutes: 30
        tokenExpiryHours: 8
        warningTimeMinutes: 2
        idleTrackingEnabled: true
        ssoSilentRenewalEnabled: true
        ssoFallbackBehavior: redirect
        passwordSilentRenewalEnabled: false
        passwordFallbackBehavior: logout
    AuthUserSummary:
      type: object
      description: Compact User payload returned with auth tokens.
      properties:
        id:
          type: string
        email:
          type: string
          format: email
        fullName:
          type: string
        organizationId:
          type: string
        workosOrganizationId:
          type: string
        accessRole:
          type: string
        departmentId:
          type: string
        workosUserId:
          type: string
        conversationOpenPreference:
          type: string
      required:
        - id
        - email
        - organizationId
        - accessRole
      additionalProperties: true
      example:
        id: 5f7b1c2e8a1d4e0012c3b4a5
        email: admin@acme.example
        fullName: Acme Admin
        organizationId: 64a1b2c3d4e5f60012345678
        accessRole: ADMIN
        conversationOpenPreference: split

````