# Update user data

- Operation ID: `updateUserDataUsingPOST`
- HTTP method: `POST`
- Path: `/uauth/users/{userId}`
- [Human-readable API reference](https://hub.synerise.com/api-reference/identity-and-access-management#tag/User-management/operation/updateUserDataUsingPOST)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /uauth/users/{userId}:
    post:
      tags:
        - User management
      summary: Update user data
      operationId: updateUserDataUsingPOST
      parameters:
        - name: userId
          in: path
          required: true
          description: User ID
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              required:
                - roles
              allOf:
                - type: object
                  properties:
                    firstName:
                      type: string
                      description: First name of the user
                    lastName:
                      type: string
                      description: Last name of the user
                    avatar:
                      type: string
                      description: URL of the user's avatar
                    phone:
                      type: string
                      description: User's phone number
                    language:
                      type: string
                      enum:
                        - pl
                        - es
                        - pt
                        - en-GB
                        - en-US
                      description: User's interface language
                    organizationRole:
                      type: string
                      description: User's role in the organization
                    introduction:
                      type: string
                      description: User's introduction
                    confirmed:
                      type: boolean
                      description: Informs if the account is confirmed
                    mailAccountId:
                      type: integer
                      description: Unused field
                    description:
                      type: string
                      description: User's description
                    dateFormatNotation:
                      type: string
                      enum:
                        - US
                        - EU
                    timeFormatNotation:
                      type: string
                      enum:
                        - US
                        - EU
                    numberFormatNotation:
                      type: string
                      enum:
                        - US
                        - EU
                - type: object
                  properties:
                    roles:
                      type: array
                      description: An array of roles (IDs) assigned to the user in the currently selected workspace
                      items:
                        type: integer
                        format: int64
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  avatar:
                    type: string
                    description: URL of the user's avatar
                  confirmed:
                    type: boolean
                    description: Informs if the account is confirmed
                  created:
                    type: string
                    format: date-time
                    description: Account creation date
                  description:
                    type: string
                    description: User's description
                  displayName:
                    type: string
                    description: User's display name
                  email:
                    type: string
                    description: User's email address
                  firstName:
                    type: string
                    description: First name of the user
                  id:
                    type: integer
                    format: int64
                    description: User ID
                  introduction:
                    type: string
                    description: User's introduction
                  isTheSameUserAsLoggedIn:
                    type: boolean
                    description: Informs if the user who made the request is the same as the subject of the request
                  language:
                    type: string
                    enum:
                      - pl
                      - es
                      - pt
                      - en-GB
                      - en-US
                    description: User's interface language
                  lastLogin:
                    type: string
                    format: date-time
                    description: Last login time
                  lastName:
                    type: string
                    description: Last name of the user
                  mailAccountId:
                    type: integer
                    description: Unused field
                  organizationRole:
                    type: string
                    description: User's role in the organization
                  phone:
                    type: string
                    description: User's phone number
                  roles:
                    type: array
                    description: An array of roles (IDs) assigned to the user in the currently selected workspace
                    items:
                      type: integer
                      format: int64
                  status:
                    type: string
                    description: Account status
                    enum:
                      - ACTIVE
                      - PENDING
                  superAdmin:
                    type: boolean
                    description: Informs if the user is a super admin
                  updated:
                    type: string
                    format: date-time
                    description: Last update time
                  isMfaEnabled:
                    type: boolean
                    description: Informs if multi-factor authentication for the user is active
                  passwordLastModificationDate:
                    type: string
                    format: date-time
                    description: Date and time of last password change
                  dateFormatNotation:
                    type: string
                    enum:
                      - US
                      - EU
                  timeFormatNotation:
                    type: string
                    enum:
                      - US
                      - EU
                  numberFormatNotation:
                    type: string
                    enum:
                      - US
                      - EU
        "201":
          description: Created
          content: {}
        "401":
          description: Unauthorized
          content: {}
        "403":
          description: Forbidden
          content: {}
        "404":
          description: Not Found
          content: {}
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/identity-and-access-management#tag/User-management/operation/updateUserDataUsingPOST
      description: |
        

        ---

        **API consumer:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/uauth/users/%7BuserId%7D \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"firstName":"string","lastName":"string","avatar":"string","phone":"string","language":"pl","organizationRole":"string","introduction":"string","confirmed":true,"mailAccountId":0,"description":"string","dateFormatNotation":"US","timeFormatNotation":"US","numberFormatNotation":"US","roles":[0]}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"firstName\":\"string\",\"lastName\":\"string\",\"avatar\":\"string\",\"phone\":\"string\",\"language\":\"pl\",\"organizationRole\":\"string\",\"introduction\":\"string\",\"confirmed\":true,\"mailAccountId\":0,\"description\":\"string\",\"dateFormatNotation\":\"US\",\"timeFormatNotation\":\"US\",\"numberFormatNotation\":\"US\",\"roles\":[0]}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/uauth/users/%7BuserId%7D", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "firstName": "string",
              "lastName": "string",
              "avatar": "string",
              "phone": "string",
              "language": "pl",
              "organizationRole": "string",
              "introduction": "string",
              "confirmed": true,
              "mailAccountId": 0,
              "description": "string",
              "dateFormatNotation": "US",
              "timeFormatNotation": "US",
              "numberFormatNotation": "US",
              "roles": [
                0
              ]
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/uauth/users/%7BuserId%7D");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/uauth/users/%7BuserId%7D",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              firstName: 'string',
              lastName: 'string',
              avatar: 'string',
              phone: 'string',
              language: 'pl',
              organizationRole: 'string',
              introduction: 'string',
              confirmed: true,
              mailAccountId: 0,
              description: 'string',
              dateFormatNotation: 'US',
              timeFormatNotation: 'US',
              numberFormatNotation: 'US',
              roles: [0]
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/uauth/users/%7BuserId%7D');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"firstName":"string","lastName":"string","avatar":"string","phone":"string","language":"pl","organizationRole":"string","introduction":"string","confirmed":true,"mailAccountId":0,"description":"string","dateFormatNotation":"US","timeFormatNotation":"US","numberFormatNotation":"US","roles":[0]}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/uauth/users/%7BuserId%7D")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"firstName\":\"string\",\"lastName\":\"string\",\"avatar\":\"string\",\"phone\":\"string\",\"language\":\"pl\",\"organizationRole\":\"string\",\"introduction\":\"string\",\"confirmed\":true,\"mailAccountId\":0,\"description\":\"string\",\"dateFormatNotation\":\"US\",\"timeFormatNotation\":\"US\",\"numberFormatNotation\":\"US\",\"roles\":[0]}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: User management
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
