Create New User

Create Members (Users)

POST https://{server_address}/api/v1/organization/users/create

This endpoint will first create new organization under "Clients organizations" and then create a new user as a member of previously created organization.

Headers

NameTypeDescription

Authorization*

Bearer {access_token}

Content-Type*

application/json

Request Body

NameTypeDescription

email*

john@example.com

New user's email

passwordHash*

tk++TTJLCEKfWuhQyGAKCSRMop6wyIexGKylaknsUo8=

New user's password. See user password creation notes.

name*

John Doe

New user's name. May contain up to 50 symbols. Only letters, hyphens, spaces, dots and apostrophes are allowed.

title

String

New user's title. May contain up to 50 symbols. Only letters, hyphens and spaces are allowed.

nickName

String

New user's nickname. May contain up to 50 symbols. Only letters, digits, hyphens and spaces are allowed.

phoneNumber

+3801234567

New user's phone number. Should be prefixed with +.

organizationName

My Organization

New user's organization name. Should be from 3 to 100 symbols. Only letters, digits, dots, apostrophe, hyphens and spaces are allowed.

timeZone

Europe/Kiev

New user's timezone.

address

String

New user's address.

address.fullAddress

String

New user's full address. Should be up to 512 symbols.

address.city

String

New user's city. Should be up to 50 symbols.

address.country

String

New user's country. Should be up to 74 symbols.

address.state

String

New user's state. Should be up to 40 symbols.

address.zip

String

New user's zip code. Should be up to 12 symbols.

Request examples:

# curl command example:
$ curl -X POST -H "Content-Type: application/json" \
      -H "Authorization: Bearer {accessToken}" \
      -d '{"email":"test@example.com","passwordHash":"tk++TTJLCEKfWuhQyGAKCSRMop6wyIexGKylaknsUo8=","name":"Test user","address":{"city":"Kyiv","country":"Ukraine"}}' \
      https://fra1.blynk.cloud/api/v1/organization/users/create

$ curl -X POST -H "Content-Type: application/json" \
      -H "Authorization: Bearer eIdWHQqRfFmvP5LDDh-IGxPUzi7I27HthzCPAVmS" \
      -d '{"email":"test@example.com","passwordHash":"tk++TTJLCEKfWuhQyGAKCSRMop6wyIexGKylaknsUo8=","name":"Test user","address":{"city":"Kyiv","country":"Ukraine"}}' \
      https://fra1.blynk.cloud/api/v1/organization/users/create

User password

Blynk using SHA-256 algorithm to encrypt user's password. Blynk never accept plain password on server-side, so to specify user's password you have to correctly encrypt it on your side.

Steps to encrypt password:

  1. Hash the email using SHA-256.

  2. Concatenate this hash with the password.

  3. Hash this concatenated string again using SHA-256.

  4. Encode the final hash in Base64.

Here is example Java code to encrypt user's password:

String userEmail = "john@example.com";
String userPassword = "mySuperSecretPassword";

byte[] salt = MessageDigest.getInstance("SHA-256")
        .digest(userEmail.toLowerCase().getBytes(StandardCharsets.UTF_8));

MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(userPassword.getBytes(StandardCharsets.UTF_8));        
byte[] byteData = md.digest(salt);
String sha256Password = Base64.getEncoder().encodeToString(byteData);
// Pass 'sha256Password' to Blynk

Example bash command to encrypt a user's password (please make sure you enter your email address in lowercase letters and use unix-like OS to execute this command):

$ (echo -n "mySuperSecretPassword"; echo -n "email@example.com" | openssl dgst -sha256 -binary) | openssl dgst -sha256 -binary | openssl base64

Last updated