> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# How to create a new active user for CLM and eSignature

> This topic demonstrates how to use the Docusign Admin API to create a new CLM and eSignature user and activate their account automatically.

This topic demonstrates how to use the  [Docusign Admin API](/docs/admin-api) to create a new CLM and eSignature user and activate their account automatically. Auto-activating a user’s account membership bypasses the activation email and password setup process, which is particularly useful for integrations and customers using single sign-on (SSO).

> **Warning**
>
> The auto-activate option is only available for users with an email address domain that has been claimed by your organization.

> **Note**
>
> Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects: [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).

## Required data

Running the code in this how-to requires this data:

| Data element              | Description                                                                                                                                                                                                                                                                                                                                    |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Admin access              | The caller must be at least one of the following:- A full organization administrator
- A delegated organization administratorSee [Organization Administrators](https://support.docusign.com/s/document-item?language=en_US\&rsc_301\&bundleId=rrf1583359212854\&topicId=god1583359152535.html&_LANG=enus) for details on Docusign Admin roles. |
| \{API_ACCOUNT_ID}         | A [GUID](http://guid.one/) value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the **API Account ID** field on the [Apps and Keys](https://admindemo.docusign.com/authenticate?goTo=appsAndKeys) page.                                                       |
| \{BASE_PATH}              | A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at https\://\<domain>/management Where \<domain> is api-d.docusign.net for the developer environment and api.docusign.net for production.                                         |
| CLM enabled account       | The account used to call the API must have CLM enabled for their account. See [Support for Docusign CLM](https://support.docusign.com/s/articles/DocuSign-and-SpringCM?language=en_US\&rsc_30) for more information.                                                                                                                           |
| \{CLM_PERMISSION_PROFILE} | A string value that identifies your CLM [permission profile](/docs/esign-rest-api/esign101/concepts/permissions). This value is automatically generated by Docusign for any permission profile you create.                                                                                                                                     |
| \{GROUP_ID}               | A string value that identifies a given [user group](https://support.docusign.com/s/document-item?language=en_US\&bundleId=pik1583277475390\&topicId=cuv1583277363488.html). This value is automatically generated by Docusign for any user group you create.                                                                                   |
| \{ORGANIZATION_ID}        | A [GUID](http://guid.one/) value that identifies the the organization that contains the account to which the user will be added. Copy the value from the **Organization ID** field in the **Organization** section of the [Account Profile](https://admindemo.docusign.com/authenticate?goTo=accountProfile) page.                             |
| \{PERMISSION_PROFILE_ID}  | A string value that identifies your [permission profile](/docs/esign-rest-api/esign101/concepts/permissions). This value is automatically generated by Docusign for any permission profile you create.                                                                                                                                         |

## Step 1. Obtain your OAuth token

To make the API calls shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

Docusign Admin OAuth access tokens are the same ones used for our [eSignature REST API](/docs/esign-rest-api/esign101/auth), although you must request one or more Docusign Admin scopes to call the Docusign Admin API. The endpoint calls made in this how-to require that you request the Docusign Admin-specific `user_write` scope when obtaining your access token.

> **Note**
>
> See [Docusign Admin Authentication](/docs/admin-api/admin101/auth) for details and the full list of Docusign Admin scopes.

![Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant](/_fern-files/_img/64f473773042ee439449a096bf7673292b1585b86a4ccc55f82ba0dda41f61a1.webp)

## Step 2. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for \{ACCESS_TOKEN}.

**`Bash`**

```bash title="Bash"
declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
    '--header' "Accept: application/json" \
    '--header' "Content-Type: application/json")
```

**`C#`**

```csharp title="C#"
var apiClient = new DocuSignClient(basePath);
apiClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
```

**`Java`**

```java title="Java"
ApiClient apiClient = new ApiClient(basePath);
apiClient.addDefaultHeader(
        HttpHeaders.AUTHORIZATION,
        BEARER_AUTHENTICATION + accessToken);
```

**`Node.js`**

```javascript title="Node.js"
let dsApiClient = new docusignAdmin.ApiClient();
dsApiClient.setBasePath(dsConfig.adminAPIUrl);
dsApiClient.addDefaultHeader('Authorization', 'Bearer ' + args.accessToken);
```

**`PHP`**

```php title="PHP"
$config = new Configuration();
$config->setAccessToken($accessToken);
$config->setHost('https://api-d.docusign.net/management');
$config->addDefaultHeader('Authorization', 'Bearer ' . $accessToken);
$this->apiClient = new ApiClient($config);
```

**`PowerShell`**

```text title="PowerShell"
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.add("Authorization", "Bearer $accessToken")
$headers.add("Accept", "application/json")
$headers.add("Content-Type", "application/json")
```

**`Python`**

```python title="Python"
api_client = ApiClient(host=DS_CONFIG["admin_api_client_host"])
api_client.set_default_header(
    header_name="Authorization",
    header_value=f"Bearer {access_token}"
)
```

**`Ruby`**

```ruby title="Ruby"
configuration = DocuSign_Admin::Configuration.new
configuration.host = Rails.configuration.admin_host
@api_client = DocuSign_Admin::ApiClient.new(configuration)
@api_client.set_default_header('Authorization', "Bearer #{args[:access_token]}")
```

## Step 3. Retrieve CLM and eSignature permission profiles

Make a GET request to obtain a single list containing the eSignature product ID and permission profile IDs and the CLM product ID and permission profile IDs. Here’s how you make the call, but make sure to substitute your base path for \{BASE_PATH}, your API account ID for \{API_ACCOUNT_ID}, and your organization ID for \{ORGANIZATION_ID}. Select one of the returned eSignature permission profile IDs and one of the returned CLM permission profile IDs.

**`Bash`**

```bash title="Bash"
Status=$(curl -w '%{http_code}' -i --request GET ${base_path}/v2.1/organizations/${ORGANIZATION_ID}/accounts/${API_ACCOUNT_ID}/products/permission_profiles \
     "${Headers[@]}" \
     --output ${response})
```

**`C#`**

```csharp title="C#"
var productPermissionProfileApi = new ProductPermissionProfilesApi(apiClient);
var productPermissionProfiles = productPermissionProfileApi.GetProductPermissionProfiles(organizationId.Value, Guid.Parse(accountId));
this.ViewBag.CLMPermissionProfiles = productPermissionProfiles.ProductPermissionProfiles.Find(x => x.ProductName == "CLM").PermissionProfiles;
this.ViewBag.ESignPermissionProfiles = productPermissionProfiles.ProductPermissionProfiles.Find(x => x.ProductName == "ESign").PermissionProfiles;
clmProductId = productPermissionProfiles.ProductPermissionProfiles.Find(x => x.ProductName == "CLM").ProductId;
eSignProductId = productPermissionProfiles.ProductPermissionProfiles.Find(x => x.ProductName == "ESign").ProductId;
```

**`Java`**

```java title="Java"
ProductPermissionProfilesApi permissionsInfo = this.createProductPermissionProfilesApi(user.getAccessToken(),
        session.getBasePath());
ProductPermissionProfilesResponse profiles = permissionsInfo.getProductPermissionProfiles(organizationId,
        accountId);
ProductPermissionProfileResponse clmProfiles = null;
ProductPermissionProfileResponse eSignProfiles = null;
UUID clmProductId = null;
UUID eSignProductId = null;
// filter by each type per response
for (ProductPermissionProfileResponse eachOne : profiles.getProductPermissionProfiles()) {
    if (eachOne.getProductName().equals("CLM")) {
        clmProductId = eachOne.getProductId();
        clmProfiles = eachOne;
    } else {
        eSignProductId = eachOne.getProductId();
        eSignProfiles = eachOne;
    }
}
```

**`Node.js`**

```javascript title="Node.js"
const productPermissionProfilesApi = new docusignAdmin.ProductPermissionProfilesApi(dsApiClient);
const productPermissionProfiles = await productPermissionProfilesApi.getProductPermissionProfiles(args.organizationId, args.accountId, (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});
```

**`PHP`**

```php title="PHP"
$eSignProductId = $clmProductId = $clmPermissionProfiles = $eSignPermissionProfiles = "";
$this->orgId = $this->clientService->getOrgAdminId($this->args);
$ppReq = $this->clientService->permProfilesApi();
$permissionProfiles = $ppReq->getProductPermissionProfilesWithHttpInfo($this->orgId, $this->args["account_id"]);

$remaining = $permissionProfiles[2]['X-RateLimit-Remaining'] ?? null;
$reset =  $permissionProfiles[2]['X-RateLimit-Reset'] ?? null;

if ($remaining !== null && $reset !== null) {
    $resetInstant = (new DateTime())->setTimestamp((int)$reset);
    error_log("API calls remaining: $remaining");
    error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
}

foreach ($permissionProfiles[0]['product_permission_profiles'] as $item) {
    if ($item['product_name'] == "CLM") {
        $clmPermissionProfiles = $item;
        $clmProductId = $item["product_id"];
    } else {
        $eSignPermissionProfiles = $item;
        $eSignProductId = $item["product_id"];
    }
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "${base_path}/v2.1/organizations/${organizationId}/accounts/${APIAccountId}/products/permission_profiles"
$response = Invoke-WebRequest -uri $uri -UseBasicParsing -headers $headers -method GET

$productProfiles = $($response.Content | ConvertFrom-Json).product_permission_profiles
```

**`Python`**

```python title="Python"
product_permission_profiles_api = ProductPermissionProfilesApi(api_client=api_client)
(profiles, status, headers) = product_permission_profiles_api.get_product_permission_profiles_with_http_info(
    organization_id=org_id,
    account_id=session["ds_account_id"]
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")

profiles_list = profiles.to_dict()["product_permission_profiles"]
```

**`Ruby`**

```ruby title="Ruby"
product_permission_profiles_api = DocuSign_Admin::ProductPermissionProfilesApi.new(@api_client)
product_permission_profiles = product_permission_profiles_api.get_product_permission_profiles(args[:organization_id], args[:account_id])
product_permission_profiles.as_json['product_permission_profiles']
```

## Step 4. Select a Docusign Admin group ID

To find the Docusign Admin group to which you want to assign the user, you need to make a GET request to obtain a list of all available Docusign Admin group IDs. Select a group ID to continue through the example. Here’s how you make the call, but make sure to substitute your base path for \{BASE_PATH}, your API account ID for \{API_ACCOUNT_ID}, and your organization ID for \{ORGANIZATION_ID}.

**`Bash`**

```bash title="Bash"
Status=$(curl -w '%{http_code}' -i --request GET ${base_path}/v2.1/organizations/${ORGANIZATION_ID}/accounts/${API_ACCOUNT_ID}/dsgroups \
     "${Headers[@]}" \
     --output ${response})
```

**`C#`**

```csharp title="C#"
var dsGroupsApi = new DSGroupsApi(apiClient);
this.ViewBag.DsGroups = dsGroupsApi.GetDSGroups(organizationId, Guid.Parse(accountId)).DsGroups;
```

**`Java`**

```java title="Java"
DsGroupsApi groupsApi = this.createDSGroupsApi(user.getAccessToken(), session.getBasePath());
DSGroupListResponse groups = groupsApi.getDSGroups(organizationId, accountId);
```

**`Node.js`**

```javascript title="Node.js"
const dsGroupsApi = new docusignAdmin.DSGroupsApi(dsApiClient);
const dsGroups = await dsGroupsApi.getDSGroups(args.organizationId, args.accountId, (error, data, response) => {
    const headers = response?.headers;

    const remaining = headers?.['x-ratelimit-remaining'];
    const reset = headers?.['x-ratelimit-reset'];

    if (remaining && reset) {
      const resetInstant = new Date(Number(reset) * 1000);

      console.log(`API calls remaining: ${remaining}`);
      console.log(`Next Reset: ${resetInstant.toISOString()}`);
    }
});
```

**`PHP`**

```php title="PHP"
$dsgReq = $this->clientService->adminGroupsApi();
$dsgRes = $dsgReq->getDSGroupsWithHttpInfo($this->orgId, $this->args["account_id"]);

$remaining = $dsgRes[2]['X-RateLimit-Remaining'] ?? null;
$reset =  $dsgRes[2]['X-RateLimit-Reset'] ?? null;

if ($remaining !== null && $reset !== null) {
    $resetInstant = (new DateTime())->setTimestamp((int)$reset);
    error_log("API calls remaining: $remaining");
    error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
}

$dsGroups = $dsgRes[0]["ds_groups"];
if ($dsgRes[0]["ds_groups"] == null) {
    throw new ApiException(
        $this->codeExampleText["CustomErrorTexts"][0]["ErrorMessage"]
    );
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "${base_path}/v2.1/organizations/${organizationId}/accounts/${APIAccountId}/dsgroups"
$response = Invoke-WebRequest -uri $uri -UseBasicParsing -headers $headers -method GET
$dsGroups = $($response.Content | ConvertFrom-Json).ds_groups
```

**`Python`**

```python title="Python"
ds_groups_api = DSGroupsApi(api_client)
(ds_groups, status, headers) = ds_groups_api.get_ds_groups_with_http_info(
    organization_id=org_id,
    account_id=session["ds_account_id"]
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
ds_groups_api = DocuSign_Admin::DSGroupsApi.new(@api_client)
ds_groups = ds_groups_api.get_ds_groups(args[:organization_id], args[:account_id])
ds_groups.as_json['ds_groups']
```

## Step 5. Construct the request body

Next, construct the request body. This contains the details of the user account to be created and an optional parameter, `auto_activate_memberships`, that automatically enables the account if set to `true`. You must also include the Docusign Admin group ID and permission profile information obtained previously.

> **Warning**
>
> Your organization’s domain must have the **Require all users to authenticate with Identity Provider** option enabled to use the `auto_activate_memberships` parameter.

**`Bash`**

```bash title="Bash"
printf \
'
{
    "user_name": "'${USER_NAME}'",
    "first_name": "'${FIRST_NAME}'",
    "last_name": "'${LAST_NAME}'",
    "email": "'${EMAIL}'",
    "auto_activate_memberships": true,
    "product_permission_profiles": [
        {
            "permission_profile_id": '$ESIGN_PERMISSION_PROFILE_ID',
            "product_id": '$ESIGN_PRODUCT_ID'
        },
        {
            "permission_profile_id": '$CLM_PERMISSION_PROFILE_ID',
            "product_id": '$CLM_PRODUCT_ID'
        }
    ],
    "ds_groups": [
        {
            "ds_group_id": "'$DS_GROUP_ID'"
        }
    ]
}' >$request_data
```

**`C#`**

```csharp title="C#"
var newMultiProductUserAddRequest = new NewMultiProductUserAddRequest();
newMultiProductUserAddRequest.UserName = userName;
newMultiProductUserAddRequest.FirstName = firstName;
newMultiProductUserAddRequest.LastName = lastName;
newMultiProductUserAddRequest.Email = email;
var productPermissionProfiles = new List<ProductPermissionProfileRequest>();
productPermissionProfiles.Add(new ProductPermissionProfileRequest { ProductId = clmProductId, PermissionProfileId = clmPermissionProfileId });
productPermissionProfiles.Add(new ProductPermissionProfileRequest { ProductId = eSignProductId, PermissionProfileId = eSignPermissionProfileId });
newMultiProductUserAddRequest.ProductPermissionProfiles = productPermissionProfiles;
newMultiProductUserAddRequest.DsGroups = new List<DSGroupRequest>();
newMultiProductUserAddRequest.DsGroups.Add(new DSGroupRequest { DsGroupId = dsGroupId });
newMultiProductUserAddRequest.AutoActivateMemberships = true;
```

**`Java`**

```java title="Java"
ProductPermissionProfileRequest clm = new ProductPermissionProfileRequest();
ProductPermissionProfileRequest eSign = new ProductPermissionProfileRequest();
clm.setPermissionProfileId(clmProfileId);
clm.setProductId(clmProductId);

eSign.setPermissionProfileId(eSignProfileId);
eSign.setProductId(eSignProductId);

DSGroupRequest dsGroup = new DSGroupRequest();
dsGroup.setDsGroupId(dsGroupId);
// Fill the request with data from the form

NewMultiProductUserAddRequest multiProductUserAddRequest = new NewMultiProductUserAddRequest()
        .defaultAccountId(accountId)
        .addProductPermissionProfilesItem(clm)
        .addProductPermissionProfilesItem(eSign)
        .addDsGroupsItem(dsGroup)
        .userName(userName)
        .firstName(firstName)
        .lastName(lastName)
        .autoActivateMemberships(true)
        .email(email);
```

**`Node.js`**

```javascript title="Node.js"
const body = {
  user_name: args.userName,
  first_name: args.firstName,
  last_name: args.lastName,
  email: args.email,
  auto_activate_memberships: true,
  product_permission_profiles: [
    {
      permission_profile_id: args.eSignPermissionProfileId,
      product_id: args.eSignProductId
    },
    {
      permission_profile_id: args.clmPermissionProfileId,
      product_id: args.clmProductId
    }
  ],
  ds_groups: [
    {
      ds_group_id: args.dsGroupId
    }
  ]
};
```

**`PHP`**

```php title="PHP"
$userAPI = $clientService->getUsersApi();

$eSignProfile = new ProductPermissionProfileRequest(
    [
        "permission_profile_id" => $arguments["esign_permission_profile_id"],
        "product_id" => $arguments["esign_product_id"]
    ]
);

$clmProfile = new ProductPermissionProfileRequest(
    [
        "permission_profile_id" => $arguments["clm_permission_profile_id"],
        "product_id" => $arguments["clm_product_id"]
    ]
);

$dsGroups = new DSGroupRequest(
    [
        'ds_group_id' => $arguments["group_id"]
    ]
);

$request = new NewMultiProductUserAddRequest(
    [
        'default_account_id' => $arguments["account_id"],
        'user_name' => $arguments["user_id"],
        'first_name' => $arguments["first_name"],
        'last_name' => $arguments["last_name"],
        'auto_activate_memberships' => true,
    ]
);
$request->setProductPermissionProfiles([$clmProfile, $eSignProfile]);
$request->setEmail($arguments["email"]);
$request->setDsGroups([$dsGroups]);
```

**`PowerShell`**

```text title="PowerShell"
$body = @"
{
  "user_name": "$userName",
  "first_name": "$firstName",
  "last_name": "$lastName",
  "email": "$userEmail",
  "auto_activate_memberships": true,
  "product_permission_profiles": [
      {
          "permission_profile_id": "$esignPermissionProfileId",
          "product_id": "$esignProductId"
      },
      {
          "permission_profile_id": "$clmPermissionProfileId",
          "product_id": "$clmProductId"
      }
  ],
  "ds_groups": [
      {
          "ds_group_id": "$dsGroupId"
      }
  ]
}
"@
```

**`Python`**

```python title="Python"
clm_product_permission_profile = ProductPermissionProfileRequest(product_id=clm_product_id, permission_profile_id=clm_permission_profile_id)
esign_product_permission_profile = ProductPermissionProfileRequest(product_id=esign_product_id, permission_profile_id=esign_permission_profile_id)
ds_group_request = DSGroupRequest(ds_group_id=args["group_id"])
new_user = NewMultiProductUserAddRequest(product_permission_profiles=[esign_product_permission_profile, clm_product_permission_profile], ds_groups=[ds_group_request], user_name=args["user_name"], first_name=args["first_name"], last_name=args["last_name"], email=args["email"], auto_activate_memberships=True)
```

**`Ruby`**

```ruby title="Ruby"
def body(args)
  {
    user_name: args[:user_name],
    first_name: args[:first_name],
    last_name: args[:last_name],
    email: args[:email],
    auto_activate_memberships: true,
    product_permission_profiles: [
      {
        permission_profile_id: args[:esign_permission_profile_id],
        product_id: args[:esign_product_id]
      },
      {
        permission_profile_id: args[:clm_permission_profile_id],
        product_id: args[:clm_product_id]
      }
    ],
    ds_groups: [
      {
        ds_group_id: args[:ds_group_id]
      }
    ]
  }
end
```

## Step 6. Call the Docusign Admin API

Now that you have constructed your API headers and request body, make a POST request to the  [MultiProductUserManagement: addOrUpdateUser](/docs/admin-api/reference/usermanagement/multiproductusermanagement/addorupdateuser) endpoint and include the request body to create the user for your organization. Here’s how you make the call, but make sure to substitute your base path for \{BASE_PATH}, your API account ID for \{API_ACCOUNT_ID}, and your organization ID for \{ORGANIZATION_ID}.

> **Note**
>
> View the source code for this how-to on GitHub: [Bash](https://github.com/docusign/code-examples-bash/blob/master/examples/Admin/eg002CreateActiveCLMESignUser.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Admin/Examples/CreateCLMESignUser.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/admin/services/CreateActiveCLMESignUserService.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/admin/examples/createCLMESignUser.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/Admin/CreateActiveCLMESignUserService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Admin/eg002CreateActiveCLMEsignUser.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/admin/examples/eg002_create_active_clm_esign_user.py), [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/admin_api/eg002_create_active_clm_esign_user_service.rb).

**`Bash`**

```bash title="Bash"
Status=$(
    curl -w '%{http_code}' -i --request POST ${base_path}/v2.1/organizations/${ORGANIZATION_ID}/accounts/${API_ACCOUNT_ID}/users/ \
    "${Headers[@]}" \
    --data-binary @${request_data} \
    --output ${response}
)
```

**`C#`**

```csharp title="C#"
var response = usersApi.AddOrUpdateUserWithHttpInfo(orgId, accountId, newMultiProductUserAddRequest);
response.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
response.Headers.TryGetValue("X-RateLimit-Reset", out string reset);

if (reset != null && remaining != null)
{
    DateTime resetDate = DateTimeOffset.FromUnixTimeSeconds(long.Parse(reset)).UtcDateTime;
    Console.WriteLine("API calls remaining: " + remaining);
    Console.WriteLine("Next Reset: " + resetDate);
}
```

**`Java`**

```java title="Java"
ApiResponse<AddUserResponse> response = usersApi.addOrUpdateUserWithHttpInfo(organizationId, accountId,
        multiProductUserAddRequest);

Map<String, List<String>> headers = response.getHeaders();
List<String> remaining = headers.get("X-RateLimit-Remaining");
List<String> reset = headers.get("X-RateLimit-Reset");

if (remaining != null & reset != null) {
    Instant resetInstant = Instant.ofEpochSecond(Long.parseLong(reset.get(0)));
    System.out.println("API calls remaining: " + remaining);
    System.out.println("Next Reset: " + resetInstant);
}

return response.getData();
```

**`Node.js`**

```javascript title="Node.js"
const usersApi = new docusignAdmin.UsersApi(dsApiClient);
return usersApi.addOrUpdateUser(body, args.organizationId, args.accountId);
```

**`PHP`**

```php title="PHP"
$addUserResponse = $userAPI->addOrUpdateUserWithHttpInfo($organizationId, $arguments["account_id"], $request);
$remaining = $addUserResponse[2]['X-RateLimit-Remaining'] ?? null;
$reset = $addUserResponse[2]['X-RateLimit-Reset'] ?? null;

if ($remaining !== null && $reset !== null) {
    $resetInstant = (new DateTime())->setTimestamp((int)$reset);
    error_log("API calls remaining: $remaining");
    error_log("Next Reset: " . $resetInstant->format(\DateTime::ATOM));
}
```

**`PowerShell`**

```text title="PowerShell"
$uri = "${base_path}/v2.1/organizations/${organizationId}/accounts/${APIAccountId}/users/"
$response = Invoke-WebRequest -uri $uri -UseBasicParsing -headers $headers -body $body -method POST
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
```

**`Python`**

```python title="Python"
users_api = UsersApi(api_client)
(response, status, headers) = users_api.add_or_update_user_with_http_info(
    organization_id=org_id,
    account_id=session["ds_account_id"],
    request=new_user
)

remaining = headers.get("X-RateLimit-Remaining")
reset = headers.get("X-RateLimit-Reset")

if remaining is not None and reset is not None:
    reset_date = dt.fromtimestamp(int(reset), tz=timezone.utc)
    print(f"API calls remaining: {remaining}")
    print(f"Next Reset: {reset_date}")
```

**`Ruby`**

```ruby title="Ruby"
users_api = DocuSign_Admin::UsersApi.new(api_client)
results, _status, headers = users_api.add_or_update_user_with_http_info(args[:organization_id], args[:account_id], body(args))

remaining = headers['X-RateLimit-Remaining']
reset = headers['X-RateLimit-Reset']

if remaining && reset
  reset_date = Time.at(reset.to_i).utc
  puts "API calls remaining: #{remaining}"
  puts "Next Reset: #{reset_date}"
end
```

## Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

**`Sample response`**

```json title="Sample response"
{
  "id": "1e4204d5-xxxx-xxxx-xxxx-730a1d33fcea",
  "site_id": x,
  "user_name": "User Name",
  "first_name": "User",
  "last_name": "Name",
  "email": "1007a@example.com",
  "language_culture": "en",
  "accounts": [
    {
      "id": "62f3f76b-xxxx-xxxx-xxxx-315e96a0d720",
      "site_id": x,
      "product_permission_profiles": [
        {
          "product_id": "f6406c68-xxxx-xxxx-xxxx-64152a26fa83",
          "product_name": "ESign",
          "permission_profiles": [
            {
              "permission_profile_id": "11xxxx73",
              "permission_profile_name": "Account Administrator"
            }
          ]
        },
        {
          "product_id": "37f013eb-xxxx-xxxx-xxxx-357b39fdbd00",
          "product_name": "CLM",
          "permission_profiles": [
            {
              "permission_profile_id": "x",
              "permission_profile_name": "CLM Admin"
            }
          ]
        }
      ],
      "ds_groups": [
        {
          "ds_group_id": "917b47ad-xxxx-xxxx-xxxx-2d3b68703788",
          "group_name": "Example Group",
          "user_count": 0
        }
      ]
    }
  ]
}
```

## Next steps

* Run this code example from our [Quickstart](/docs/esign-rest-api/quickstart) or launcher projects:    [Bash](https://github.com/docusign/code-examples-bash), [C#](https://github.com/docusign/code-examples-csharp), [Java](https://github.com/docusign/code-examples-java), [Node.js](https://github.com/docusign/code-examples-node), [PHP](https://github.com/docusign/code-examples-php), [PowerShell](https://github.com/docusign/code-examples-powershell), [Python](https://github.com/docusign/code-examples-python), or [Ruby](https://github.com/docusign/code-examples-ruby).
* Learn [How to audit users](/docs/admin-api/how-to/audit-users).
* Learn more about the new [Admin API v2.1](/docs/admin-api/admin101/versioning).
* See how to [Go-Live](/docs/admin-api/go-live) with a completed app and find the base path for API calls in the production environment.