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

# Update Users

Use this API to update user metadata based on various filters such as organization ID, document ID, folder ID and user IDs.
You can use these filters in various combinations to get the desired results.
The user metadata such as name, email etc can be updated.

# Endpoint

`POST https://api.velt.dev/v1/users/update`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body

#### **Params**

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID
    </ParamField>

    <ParamField body="documentId" type="string">
      Document ID
    </ParamField>

    <ParamField body="folderId" type="string">
      Folder ID. Either provide `documentId` or `folderId`.
    </ParamField>

    <ParamField body="users" type="User[]" required>
      Array of [User](/api-reference/sdk/models/data-models#user) objects.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### 1. Update users in a specific organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "users": [
      {
        "userId": "yourUserId1",
        "name": "User Name",
        "email": "user@email.com"
      }
    ]
  }
}
```

#### 2. Update users in a specific document within an organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "documentId": "yourDocumentId",
    "users": [
      {
        "userId": "yourUserId1",
        "name": "User Name",
        "email": "user@email.com"
      }
    ]
  }
}
```

#### 3. Update users in a specific folder within an organization

```JSON theme={null}
{
  "data": {
    "organizationId": "yourOrganizationId",
    "folderId": "yourFolderId",
    "users": [
      {
        "userId": "yourUserId1",
        "name": "User Name",
        "email": "user@email.com"
      }
    ]
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "User(s) processed successfully.",
    "data": {
      "yourUserId1": {
        "success": true,
        "id": "7d87015b055a168b098cf05b870e40ff",
        "message": "User updated."
      }
    }
  }
}
```

#### Some User(s) Not Found

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "User(s) processed successfully.",
    "data": {
      "yourUserId1": {
        "success": true,
        "id": "7d87015b055a168b098cf05b870e40ff",
        "message": "User updated."
      },
      "yourUserId2": {
        "success": false,
        "id": "ad22d93b49ad990d2b3d582d08d7768a",
        "message": "User does not exist."
      }
    }
  }
}
```

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "User(s) processed successfully.",
      "data": {
        "yourUserId1": {
          "success": true,
          "id": "7d87015b055a168b098cf05b870e40ff",
          "message": "User updated."
        }
      }
    }
  }
  ```
</ResponseExample>
