Update Metadata for Organization Users

In BoldSign, metadata allows you to store additional information about users in the form of key-value pairs. This feature is especially useful for account administrators who need to organize and access specific details about users efficiently. Each user can have up to 50 key-value pairs, where the key is limited to 50 characters and the value to 500 characters.

The metadata added to users is not only stored within the system but is also included in document transaction CSV exports, with each key-value pair represented as a separate column.

To add metadata, using the BoldSign API, you will need the userId of the user you wish to update the metadata. You can get the ID of the user by listing your users using the API. Refer to this for Listing Users

Below are examples codes of how to update metadata details for a user:

curl --location --request PUT 'https://api.boldsign.com/v1-beta/users/updateMetaData' \
--header 'accept: */*' \
--header 'X-API-KEY: {apikey}' \
--header 'Content-Type: application/json' \
--data '{
  "userId": "{your user id}",
  "metaData": {
    "Department": "Finance",
    "Role": "Manager",
    "Location":"New york"
  }
}'

var apiClient = new ApiClient("https://api.boldsign.com", "{apikey}");
var userClient = new UserClient(apiClient);

var updateUserMetaData = new UpdateUserMetaData()
{
    UserId = "{your user id}",
    MetaData = new Dictionary<string, string>()
    {
        ["Department"] = "Sales",
    },
};

await userClient.UpdateUsersMetaDataAsync(updateUserMetaData);

import boldsign

configuration = boldsign.Configuration(host = "https://api.boldsign.com", api_key="YOUR_API_KEY")

with boldsign.ApiClient(configuration) as api_client:

    user_api = boldsign.UserApi(api_client)
    
    update_user_meta_data = boldsign.UpdateUserMetaData(
        user_id="USER_ID",
        meta_data={
            "Department": "Finance",
            "Role": "Manager",
            "Location":"New york"
        }
    )

    user_api.update_meta_data(update_user_meta_data)
import { UserApi, UpdateUserMetaData } from "boldsign";

const userApi = new UserApi("https://api.boldsign.com");
userApi.setApiKey("YOUR_API_KEY");

const updateUserMetaData = new UpdateUserMetaData();
updateUserMetaData.userId = "USER_ID";
updateUserMetaData.metaData = {
    "Department": "Sales",
    "Role":"Manager",
    "Location":"New York"
};

userApi.updateMetaData(updateUserMetaData);

<?php require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\UserApi;
use BoldSign\Model\UpdateUserMetaData;

$config = new Configuration();
$config->setHost("https://api.boldsign.com");
$config->setApiKey('YOUR_API_KEY');

$user_api = new UserApi($config);

$update_user_meta_data = new UpdateUserMetaData();
$update_user_meta_data->setUserId('USER_ID');
$update_user_meta_data->setMetaData([
    "Department" => "Sales",
    "Role" => "Manager",
    "Location" => "New york"
]);

$user_api->updateMetaData($update_user_meta_data);
import java.util.HashMap;
import java.util.Map;

import com.boldsign.ApiClient;
import com.boldsign.ApiException;
import com.boldsign.Configuration;
import com.boldsign.api.UserApi;
import com.boldsign.model.UpdateUserMetaData;

ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.boldsign.com");
client.setApiKey("YOUR_API_KEY");


    UserApi userApi = new UserApi(client);

    UpdateUserMetaData updateUserMetaData = new UpdateUserMetaData();
    updateUserMetaData.setUserId("USER_ID");

    Map<String, String> metaData = new HashMap<>();
    metaData.put("Department", "Sales");
    metaData.put("Role", "Manager");
    metaData.put("Location", "New york");
    updateUserMetaData.setMetaData(metaData);

    userApi.updateMetaData(updateUserMetaData);

In the provided code example, make sure to replace values for userId with the ID of the user you want to update their metadata. In the metadata section add your additional details such as department, role, location e.t.c. Once the codes are executed, the user will be updated with the added information.