> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CreateUser

> CreateUser method in the ABBYY FlexiCapture user management API creates a user from name, password hash, email, and tenant, and returns the new user ID.

## What it does

Creates a new user.

## Definition

```
int CreateUser( string userName, string fullName, string password, string email, string tenantName );
```

## Parameters

| **Name**   | **Type** | **Description**    |
| ---------- | -------- | ------------------ |
| userName   | string   | User name          |
| fullName   | string   | Full user name     |
| password   | string   | User password hash |
| email      | string   | User e-mail        |
| tenantName | string   | Tenant name        |

Sample code for calculating the password hash:

```
public static string GetPasswordHashWithSalt( string login, string password )
        {
            string salt = GetPasswordSha256Hash(login.ToUpper());
            return GetPasswordSha256Hash(password + salt);
        }
        private static string GetPasswordSha256Hash( string password )
        {
            Encoding enc = Encoding.GetEncoding("UTF-16");
            byte[] buffer = enc.GetBytes(password);
            var cryptoTransformSHA256 = new SHA256CryptoServiceProvider();
            string hash = BitConverter.ToString(cryptoTransformSHA256.ComputeHash(buffer)).Replace("-", "");
            return hash;
        }
```

## Returned value

| **Type** | **Description** |
| -------- | --------------- |
| int      | User ID         |

<Note>
  A T-SQL code that is used to check whether the password was correctly encrypted:
</Note>

```
Select Convert( nvarchar(255), HASHBYTES( 'SHA2_256', N'myPassword' + Convert( nvarchar(64), HASHBYTES('SHA2_256', UPPER(name) ), 2) ), 2)
```
