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

# Update user language

> Update the language preference for a user account.



## OpenAPI

````yaml PATCH /users/language
openapi: 3.0.3
info:
  title: Wealthyhood Users API
  version: 1.0.0
  description: >
    User management endpoints for creating and managing user accounts in the
    Wealthyhood platform.


    All requests require a bearer access token with the advertised scopes, and
    must include 

    appropriate authentication headers.
servers:
  - url: https://{host}
    variables:
      host:
        default: api.wealthyhood.com
        description: Wealthyhood API host name.
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Create and manage user accounts.
paths:
  /users/language:
    patch:
      tags:
        - Users
      summary: Update user language preference
      description: >
        Update the language preference for a B2B user. This endpoint requires
        the `x-user-id` header

        to identify the user whose language preference should be updated.


        **Required fields:**

        - Language preference (must be "en" for English or "el" for Greek)


        **Headers:**

        - `x-user-id`: MongoDB ObjectId of the user whose language preference
        should be updated
      parameters:
        - name: x-user-id
          in: header
          required: true
          description: >-
            MongoDB ObjectId of the user whose language preference should be
            updated
          schema:
            type: string
            pattern: ^[a-f0-9]{24}$
          example: 64f0c51e7fb3fc001234a001
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserLanguageRequest'
            examples:
              english:
                summary: Set language to English
                value:
                  language: en
              greek:
                summary: Set language to Greek
                value:
                  language: el
      responses:
        '204':
          description: Language preference updated successfully
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
components:
  schemas:
    UpdateUserLanguageRequest:
      type: object
      required:
        - language
      properties:
        language:
          type: string
          description: >-
            User's preferred language. Valid values are "en" (English) or "el"
            (Greek).
          enum:
            - en
            - el
          example: en
      additionalProperties: false
    ApiErrorResponse:
      type: object
      properties:
        status:
          type: integer
          description: HTTP status code
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message
            description:
              type: string
              description: Additional error details
              nullable: true
        responseId:
          type: string
          format: uuid
          description: Unique identifier for this error response
      additionalProperties: false
  responses:
    BadRequestError:
      description: Validation failure or business rule violation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          examples:
            invalidEmail:
              summary: Invalid email format
              value:
                status: 400
                error:
                  message: Invalid email address format
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
            missingFields:
              summary: Missing required fields
              value:
                status: 400
                error:
                  message: 'Missing required fields: firstName, lastName'
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
            addressCountryMismatch:
              summary: Address country code mismatch
              value:
                status: 400
                error:
                  message: Address countryCode must match residencyCountry
                responseId: 3f0fd3bf-a2ff-4c0e-9b1d-5d7055dbf6cd
    UnauthorizedError:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorResponse'
          example:
            status: 401
            error:
              message: Unauthorized - Invalid or missing authentication token
            responseId: 145f2b0d-1d5b-4e91-8d0d-7af0ae9ad13a
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Auth0-issued access token that includes the scopes listed for the
        endpoint.

````