> 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 update user product permission profiles using an email address

This topic demonstrates how to update user product permission profiles. There may only be one permission profile assigned to a user per product.

> **Note**
>
> This endpoint can only be used by organizations that have purchased Docusign plans for both CLM and eSignature.

> **Warning**
>
> If the eSignature permission profile of the last eSignature admin user is updated to non-admin access, admin access will be removed from that account. Similarly, if the CLM permission profile of the last CLM admin user is updated to non-admin access, CLM access will be removed from the account.

> **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                                                                                                                                                                                                                                                                                                        |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| \{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.             |
| \{EMAIL_ADDRESS}         | An email address for a user in the given organization.                                                                                                                                                                                                                                                             |
| \{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.                                                                                                             |
| \{PRODUCT_ID}            | A string value that identifies the product associated with your permission profile. This value should should be either:- 37f013eb-7012-4588-8028-357b39fdbd00 for the CLM product, or
- f6406c68-225c-4e9b-9894-64152a26fa83 for the eSignature product.                                                           |

## Step 1. Obtain your OAuth token

To make the API call 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. See [Confidential Authorization Code Grant](/platform/auth/authcode#confidential-authorization-code-grant) for guidance on your options to get an Confidential Authorization Code Grant  OAuth token.

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](/docs/admin-api/admin101/auth) to call the Docusign Admin API. The endpoint call made in this how-to requires 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"
const dsApiClient = new docusignAdmin.ApiClient();
dsApiClient.setBasePath(args.basePath);
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. Construct the request body

Construct your request body as shown, but make sure to substitute the email address you are interested in for \{EMAIL_ADDRESS}, the desired permission profile ID for \{PERMISSION_PROFILE_ID}, and the associated product ID for \{PRODUCT_ID}.

**`Bash`**

```bash title="Bash"
printf \
'{
  "email": "'${EMAIL_ADDRESS}'",
  "product_permission_profiles": [
    {
      "product_id": '${PRODUCT_ID}',
      "permission_profile_id": '${PERMISSION_PROFILE_ID}',
    }
  ]
}
' >>$request_data
```

**`C#`**

```csharp title="C#"
var userProductPermissionProfilesRequest = new UserProductPermissionProfilesRequest
{
    Email = emailAddress,
    ProductPermissionProfiles = new List<ProductPermissionProfileRequest>
    {
        new ProductPermissionProfileRequest
        {
            PermissionProfileId = permissionProfileId,
            ProductId = productId,
        },
    },
};
```

**`Java`**

```java title="Java"
var productPermissionProfileRequest = new ProductPermissionProfileRequest();
productPermissionProfileRequest.setPermissionProfileId(permissionProfileId);
productPermissionProfileRequest.setProductId(productId);

var userProductPermissionProfilesRequest = new UserProductPermissionProfilesRequest();
userProductPermissionProfilesRequest.email(emailAddress);
userProductPermissionProfilesRequest.addProductPermissionProfilesItem(productPermissionProfileRequest);
```

**`Node.js`**

```javascript title="Node.js"
const userProductPermissionProfilesRequest = {
  email: args.email,
  product_permission_profiles: [
    {
      permission_profile_id: args.permissionProfileId,
      product_id: args.productId
    }
  ]
};
```

**`PHP`**

```php title="PHP"
$userProductPermissionProfilesRequest = new UserProductPermissionProfilesRequest([
    'email' => $emailAddress,
    'product_permission_profiles' => [new ProductPermissionProfileRequest([
        'product_id' => $productId,
        'permission_profile_id' => $permissionProfileId,
    ])],
]);
```

**`PowerShell`**

```text title="PowerShell"
$body = @"
{
    "email": "$emailAddress",
    "product_permission_profiles": [
        {
        "product_id": '$productId',
        "permission_profile_id": '$permissionProfileId',
        }
    ]
}
"@
```

**`Python`**

```python title="Python"
product_permission_profile = ProductPermissionProfileRequest(
    permission_profile_id=permission_profile_id,
    product_id=product_id
)
user_product_permission_profile_request = UserProductPermissionProfilesRequest(
    email=clm_email,
    product_permission_profiles=[product_permission_profile]
)
```

**`Ruby`**

```ruby title="Ruby"
product_permission_profile = DocuSign_Admin::ProductPermissionProfileRequest.new({ 'permission_profile_id' => args[:permission_profile_id], 'product_id' => args[:product_id] })
user_product_permission_profile_request = DocuSign_Admin::UserProductPermissionProfilesRequest.new({ 'email' => args[:email], 'product_permission_profiles' => [product_permission_profile] })
```

## Step 4. Call the Docusign Admin API

Now that you have constructed your request body, make a POST request to the  [MultiProductUserManagement: addUserProductPermissionProfilesByEmail](/docs/admin-api/reference/usermanagement/multiproductusermanagement/adduserproductpermissionprofilesbyemail) method and include the request body to add a product permission profile to the specified user. Please read the [warning](/docs/admin-api/how-to/update-user-product-permission-profiles-using-email#:~:text=CLM%20and%20eSignature.-,Warning,-%3A%20If%20the) about using this endpoint.

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/eg008UpdateUserProductPermissionProfile.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Admin/Examples/UpdateUserProductPermissionProfileByEmail.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/admin/services/UpdateUserProductPermissionProfileByEmail.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/admin/examples/updateUserProductPermissionProfile.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/Admin/UpdateUserProductPermissionProfileByEmailService.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Admin/eg008UpdateUserProductPermissionProfile.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/admin/examples/eg008_update_user_product_permission_profile.py), or [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/admin_api/eg008_update_user_product_permission_profile_service.rb)

**`Bash`**

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

**`C#`**

```csharp title="C#"
var response = productPermissionProfilesApi.AddUserProductPermissionProfilesByEmailWithHttpInfo(
    orgId,
    accountId,
    userProductPermissionProfilesRequest);
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);
}

return response.Data;
```

**`Java`**

```java title="Java"
ApiResponse<UserProductPermissionProfilesResponse> response = productPermissionProfilesApi
        .addUserProductPermissionProfilesByEmailWithHttpInfo(
                organizationId,
                accountId,
                userProductPermissionProfilesRequest);

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 productPermissionProfilesApi = new docusignAdmin.ProductPermissionProfilesApi(dsApiClient);
return productPermissionProfilesApi.addUserProductPermissionProfilesByEmail(userProductPermissionProfilesRequest, args.organizationId, args.accountId);
```

**`PHP`**

```php title="PHP"
$response = $productPermissionProfilesApi->addUserProductPermissionProfilesByEmailWithHttpInfo(
    $organizationId,
    $accountId,
    $userProductPermissionProfilesRequest
);

$remaining = $response[2]['X-RateLimit-Remaining'] ?? null;
$reset = $response[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));
}

return $response[0];
```

**`PowerShell`**

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

**`Python`**

```python title="Python"
product_permission_profiles_api = ProductPermissionProfilesApi(api_client=api_client)
(response, status, headers) = product_permission_profiles_api.add_user_product_permission_profiles_by_email_with_http_info(
    organization_id=org_id,
    account_id=account_id,
    user_product_permission_profiles_request=user_product_permission_profile_request
)

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"
product_permission_profiles_api = DocuSign_Admin::ProductPermissionProfilesApi.new(api_client)
results, _status, headers = product_permission_profiles_api.add_user_product_permission_profiles_by_email_with_http_info(args[:organization_id], args[:account_id], user_product_permission_profile_request)

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"
{
  "user_id":"10f24d0f-xxxx-xxxx-xxxx-76594f12f9d1",
  "account_id":"62f3f76b-xxxx-xxxx-xxxx-315e96a0d720",
  "product_permission_profiles": [
    {
      "product_id":"37f013eb-7012-4588-8028-357b39fdbd00",
      "product_name":"CLM",
      "permission_profiles": [
        {
          "permission_profile_id":"2",
          "permission_profile_name":"CLM User"
        }
      ]
    }
  ]
}
```

## 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).
* See [How to create a new active user for CLM and eSignature](/docs/admin-api/how-to/create-active-clm-esign-user).
* See [How to delete user product permission profiles using an email address](/docs/admin-api/how-to/delete-user-product-permission-profiles-using-email).
* 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.