How to update meta data to the users in the organization via API?

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:

Code snippet

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 requests
import json

url = "https://api.boldsign.com/v1-beta/users/updateMetaData"

payload = {
    "userId": "{your user id}",
    "metaData": {
        "Department": "Finance",
        "Role": "Manager",
        "Location":"New york"
    }
}

headers = {
    "accept": "*/*",
    "X-API-KEY": "{your API key}",
    "Content-Type": "application/json",
}

response = requests.put(url, headers=headers, data=json.dumps(payload))

const axios = require('axios');

axios
  .put(
    'https://api.boldsign.com/v1-beta/users/updateMetaData',
    {
      userId: '{your user id}',
      metaData: {
        Department: 'Sales',
        Role:'Manager',
        Location:'New York'
      },
    },
    {
      headers: {
        accept: '*/*',
        'X-API-KEY': '{your API key}',
        'Content-Type': 'application/json',
      },
    }
  )
  .then((response) => {
    console.log(response.data);
  });
<?php
require_once "vendor/autoload.php";

use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use \GuzzleHttp\Psr7\Utils;

$client = new GuzzleHttp\Client([ 'verify' => false, ]);

$headers = [
    'accept' => '*/*',
    'X-API-KEY' => '{your API key}',
    'Content-Type' => 'application/json'
];

$data = [
    "userId" => "{your user id}}",
    "metaData" => [
        "Department" => "Sales",
        "Role": "Manager",
        "Location":"New york"
    ],
];

$body = json_encode($data);

$request = new Request('PUT', 'https://api.boldsign.com/v1-beta/users/updateMetaData', $headers, $body);

$res = $client->sendAsync($request)->wait();

echo $res->getBody();

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.