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

# Update a user by ID (admin)

> Admin endpoint: updates a target user fields (name, email, phone, designation, access role, department). Returns 409 if the new email is already in use.



## OpenAPI

````yaml /api-reference/openapi.yaml put /api/user/{id}
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/user/{id}:
    put:
      tags:
        - User
      summary: Update a user by ID (admin)
      description: >-
        Admin endpoint: updates a target user fields (name, email, phone,
        designation, access role, department). Returns 409 if the new email is
        already in use.
      operationId: put_user_by_id
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateByIdRequest'
      responses:
        '200':
          description: User updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAdminMutationResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAdminErrorResponse'
        '403':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAdminErrorResponse'
        '404':
          description: User not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAdminErrorResponse'
        '409':
          description: Email already in use
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAdminErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    UserUpdateByIdRequest:
      type: object
      properties:
        fullName:
          type: string
          description: Display name shown across the UI for the target user.
        email:
          type: string
          format: email
          description: >-
            New login email; endpoint returns 409 if another user already has
            this email.
        phoneNumber:
          type: string
          description: Target user personal mobile number (E.164 preferred).
        sinchPhoneNumber:
          type: string
          description: >-
            Assigned Sinch outbound number; used as the from-number on
            user-attributed SMS.
        designation:
          type: string
          description: >-
            Free-form job title (e.g., "Senior Account Executive"); display
            only.
        accessRole:
          type: string
          description: >-
            Role granted to the user: `SUPERADMIN`, `ADMIN`, `DEPARTMENT_HEAD`,
            `SALES_REP`. Only `SUPERADMIN` callers may change this field.
        departmentId:
          type: string
          description: >-
            ObjectId of the Department the user belongs to; changes are mirrored
            to the department `managerIds` list for `DEPARTMENT_HEAD` users.
      additionalProperties: true
      example:
        fullName: Alex Rep
        accessRole: DEPARTMENT_HEAD
        departmentId: 64eea1110000000000000020
    UserAdminMutationResponse:
      type: object
      description: Returned by admin `PUT /api/user/{id}`.
      properties:
        success:
          type: boolean
          enum:
            - true
        message:
          type: string
        data:
          $ref: '#/components/schemas/UserListSummary'
      required:
        - success
        - message
        - data
      additionalProperties: true
      example:
        success: true
        message: User updated successfully
        data:
          _id: 5f7b1c2e8a1d4e0012c3b4a6
          fullName: Sam Patel
          email: sam.patel.new@acme.example
          accessRole: AGENT
          organizationId: 64a1b2c3d4e5f60012345678
          loginDisabled: false
    UserAdminErrorResponse:
      type: object
      description: >-
        Error envelope returned by admin user-management endpoints
        (delete/update/toggle-password-auth). Adds `success: false` to the
        standard `error`/`details` shape.
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        details:
          type: string
      required:
        - error
      additionalProperties: true
      example:
        success: false
        error: Unauthorized
        details: ADMIN role required
    UserListSummary:
      type: object
      description: >-
        Compact user payload returned by `POST /api/user/list` (bare array — no
        envelope).
      properties:
        _id:
          type: string
        fullName:
          type: string
        email:
          type: string
          format: email
        phoneNumber:
          type: string
        designation:
          type: string
        sinchPhoneNumber:
          type: string
        accessRole:
          type: string
        organizationId:
          type: string
        departmentId:
          type: string
        loginDisabled:
          type: boolean
      required:
        - _id
        - email
        - organizationId
        - accessRole
      additionalProperties: true
      example:
        _id: 5f7b1c2e8a1d4e0012c3b4a6
        fullName: Sam Patel
        email: sam.patel@acme.example
        phoneNumber: '+14165550100'
        accessRole: AGENT
        organizationId: 64a1b2c3d4e5f60012345678
        loginDisabled: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````