> 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 retrieve the user's Docusign profile using an email address

> This how-to articles demonstrates how to use the Docusign Admin API to retrieve the user's Docusign profile using an email address

This topic demonstrates how to obtain the user’s Docusign profile information across all Docusign accounts by specifying the user’s email address.

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

**Note:** If you only know the user’s **User ID** and do not know their email address, see [How to retrieve the user's Docusign profile using a User ID](/docs/admin-api/how-to/retrieve-docusign-profile-using-userid)

> **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                                                                                                                                                                                                                                                                                                        |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| \{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. |

## 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 apiClient = new docusignAdmin.ApiClient();
apiClient.setBasePath(args.basePath);
apiClient.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("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. Call the Admin API

Now that you have constructed your request body, make a GET request to the Admin API. Here’s how you make the call, but make sure to substitute 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/eg006RetrieveDocuSignProfileByEmailAddress.sh), [C#](https://github.com/docusign/code-examples-csharp/blob/master/launcher-csharp/Admin/Examples/RetrieveDocuSignProfileByEmailAddress.cs), [Java](https://github.com/docusign/code-examples-java/blob/master/src/main/java/com/docusign/controller/admin/examples/A006RetrieveDocuSignProfileByEmailAddress.java), [Node.js](https://github.com/docusign/code-examples-node/blob/master/lib/admin/examples/getUserProfileByEmail.js), [PHP](https://github.com/docusign/code-examples-php/blob/master/src/Services/Examples/Admin/RetrieveDocuSignProfileByEmailAddress.php), [PowerShell](https://github.com/docusign/code-examples-powershell/blob/master/examples/Admin/eg006GetUserProfileByEmail.ps1), [Python](https://github.com/docusign/code-examples-python/blob/master/app/admin/examples/eg006_get_user_profile_by_email.py), or [Ruby](https://github.com/docusign/code-examples-ruby/blob/master/app/services/admin_api/eg006_get_user_profile_by_email_service.rb).

**`Bash`**

```bash title="Bash"
# Calculate date parameter to get users modified in the last 10 days
if date -v -10d &>/dev/null; then
    # Mac
    # modified_since=`date -v -10d '+%Y-%m-%dT%H:%M:%S%z'`
    modified_since=$(date -v -10d '+%Y-%m-%d')
else
    # Not a Mac
    # modified_since=`date --date='-10 days' '+%Y-%m-%dT%H:%M:%S%z'`
    modified_since=$(date --date='-10 days' '+%Y-%m-%d')
fi

response=$(mktemp /tmp/response-admin.XXXXXX)

# Call the Admin API
curl --request GET ${base_path}/v2.1/organizations/${ORGANIZATION_ID}/users/dsprofile?email=${EMAIL_ADDRESS} \
    "${Headers[@]}" \
    --output ${response}
```

**`C#`**

```csharp title="C#"
var usersApi = new UsersApi(apiClient);
var retrieveUserOptions = new UsersApi.GetUserDSProfilesByEmailOptions
{
    email = email,
};

var userWithSearchedEmail = usersApi.GetUserDSProfilesByEmailWithHttpInfo(orgId, retrieveUserOptions);
userWithSearchedEmail.Headers.TryGetValue("X-RateLimit-Remaining", out string remaining);
userWithSearchedEmail.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"
UsersApi usersApi = createUsersApi(this.user.getAccessToken(), this.session.getBasePath());
UsersDrilldownResponse usersResponse = RetrieveDocuSignProfileByEmailAddress
        .getDocuSignProfileByEmailAddress(usersApi, organizationId, args.getEmail());
```

**`Node.js`**

```javascript title="Node.js"
const usersApi = new docusignAdmin.UsersApi(apiClient);
return usersApi.getUserDSProfilesByEmail(args.organizationId, { email: args.email });
```

**`PHP`**

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

$userOptions = new GetUserDSProfilesByEmailOptions();
$userOptions->setEmail($email);

$usersResponse = $usersApi->getUserDSProfilesByEmailWithHttpInfo($organizationId, $userOptions);

$remaining = $usersResponse[2]['X-RateLimit-Remaining'] ?? null;
$reset = $usersResponse[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}/users/dsprofile?email=${email}"
$result = Invoke-WebRequest -headers $headers -Uri $uri -body $body -Method GET
$result.Content
```

**`Python`**

```python title="Python"
users_api = UsersApi(api_client=api_client)

(results, status, headers) = users_api.get_user_ds_profiles_by_email_with_http_info(
    organization_id=org_id,
    email=email)

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)

options = DocuSign_Admin::GetUserDSProfilesByEmailOptions.new
options.email = args[:email]
results, _status, headers = users_api.get_user_ds_profiles_by_email_with_http_info(args[:organization_id], options)

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 this for each user.

**`Sample response`**

```json title="Sample response"
{
  "users": [
    {
      "id": "c316f86c-xxxx-xxxx-xxxx-6b39358381d2",
      "site_id": 1,
      "site_name": "Demo",
      "user_name": "Susan Signer",
      "first_name": "Susan",
      "last_name": "Signer",
      "user_status": "active",
      "default_account_id": "b71dbd28-xxxx-xxxx-xxxx-8d99842a7982",
      "default_account_name": "Acme",
      "language_culture": "en",
      "is_organization_admin": true,
      "created_on": "2020-09-30T21:39:06.527",
      "memberships": [
        {
          "email": "test@example.com",
          "account_id": "b71dbd28-xxxx-xxxx-xxxx-8d99842a7982",
          "external_account_id": "11xxxx33",
          "account_name": "Acme",
          "is_external_account": false,
          "status": "active",
          "product_permission_profiles": [
            {
              "product_id": "37f013eb-xxxx-xxxx-xxxx-357b39fdbd00",
              "product_name": "CLM",
              "permission_profiles": [
                {
                  "permission_profile_id": "0",
                  "permission_profile_name": "CLM Admin"
                }
              ]
            },
            {
              "product_id": "f6406c68-xxxx-xxxx-xxxx-64152a26fa83",
              "product_name": "ESign",
              "permission_profiles": [
                {
                  "permission_profile_id": "10xxxx31",
                  "permission_profile_name": "Account Administrator"
                }
              ]
            }
          ],
          "created_on": "2020-09-30T21:39:06.527",
          "ds_groups": [],
          "is_admin": true
        }
      ],
      "identities": [],
      "device_verification_enabled": true
    }
  ]
}
```

## 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 retrieve the user's Docusign profile using a User ID](/docs/admin-api/how-to/retrieve-docusign-profile-using-userid).
* Learn [How to create a new active user for CLM and eSignature](/docs/admin-api/how-to/create-active-clm-esign-user).
* 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..