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

# Update a user

> Updates the properties of the specified user. Only the provided properties will be updated. Any properties not provided will be left unchanged.

<RequestExample>
  ```ts TypeScript/JavaScript SDK theme={null}
  import { ProficientClient } from "@proficient/client";

  const proficient = new ProficientClient({
    apiKey: process.env.PROFICIENT_AI_PUBLISHABLE_KEY,
    userExternalId: "...", // The user's unique ID in your system
  });

  const userId = "u_1eRoyubdUqWifFiTREaLcvh6";

  const user = await proficient.users.update(userId, {
    // ... fields to update
  });
  ```
</RequestExample>


## OpenAPI

````yaml client-openapi POST /users/{user_id}
openapi: 3.0.1
info:
  title: api
  version: 0.0.1
servers:
  - url: https://api.proficientai.com
    description: Production (The production environment)
  - url: https://main-64bxvpctea-uc.a.run.app
    description: Staging (The staging environment)
  - url: http://localhost:8080
    description: Development (The local environment)
security: []
paths:
  /users/{user_id}:
    post:
      tags:
        - Users
      summary: Update a user
      description: >-
        Updates the properties of the specified user. Only the provided
        properties will be updated. Any properties not provided will be left
        unchanged.
      operationId: users_update
      parameters:
        - name: user_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UserId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdateParams'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '503':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    UserId:
      title: UserId
      type: string
      description: The unique identifier of the user
    UserUpdateParams:
      title: UserUpdateParams
      type: object
      description: The data with which a user is updated.
      properties:
        first_name:
          $ref: '#/components/schemas/UserFirstName'
          nullable: true
        last_name:
          $ref: '#/components/schemas/UserLastName'
          nullable: true
    User:
      title: User
      type: object
      description: <p>Represents a user of your project.</p>
      properties:
        id:
          $ref: '#/components/schemas/UserId'
        object:
          $ref: '#/components/schemas/UserObjectType'
        created_at:
          $ref: '#/components/schemas/CreatedAt'
        external_id:
          $ref: '#/components/schemas/UserExternalId'
        first_name:
          $ref: '#/components/schemas/UserFirstName'
        last_name:
          $ref: '#/components/schemas/UserLastName'
        live_mode:
          $ref: '#/components/schemas/UserLiveMode'
        updated_at:
          $ref: '#/components/schemas/UpdatedAt'
      required:
        - id
        - object
        - created_at
        - external_id
        - first_name
        - last_name
        - live_mode
        - updated_at
    ApiError:
      title: ApiError
      type: object
      description: >-
        Represents the general interface of an API error. The body of every
        error returned by the API contains `code` and `message` fields.
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
    UserFirstName:
      title: UserFirstName
      type: string
      description: The first name of the user.
    UserLastName:
      title: UserLastName
      type: string
      description: The last name of the user.
    UserObjectType:
      title: UserObjectType
      type: string
      enum:
        - user
      description: The type of the `User` object
    CreatedAt:
      title: CreatedAt
      type: integer
      description: >-
        The time at which the object was created, measured in milliseconds since
        the Unix epoch
    UserExternalId:
      title: UserExternalId
      type: string
      description: >-
        A string that uniquely identifies the user within your project. Ensure
        that this is the ID that you use to identify the user in your system
        e.g. database ID, Firebase Auth ID etc. Failing to do so may cause
        unexpected bugs and errors in your application.
    UserLiveMode:
      title: UserLiveMode
      type: boolean
      description: >-
        Whether the user exists in live mode. This will be `false` if the user
        is a test user.
    UpdatedAt:
      title: UpdatedAt
      type: integer
      description: >-
        The time at which the object was last updated, measured in milliseconds
        since the Unix epoch
    ApiErrorBody:
      title: ApiErrorBody
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ApiErrorCode'
        message:
          type: string
      required:
        - code
        - message
    ApiErrorCode:
      title: ApiErrorCode
      type: string
      enum:
        - invalid_request
        - invalid_credentials
        - forbidden
        - resource_not_found
        - conflict
        - unavailable
        - unknown

````