CreateUserCommand

Creates a user within the specified identity store.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { IdentitystoreClient, CreateUserCommand } from "@aws-sdk/client-identitystore"; // ES Modules import
// const { IdentitystoreClient, CreateUserCommand } = require("@aws-sdk/client-identitystore"); // CommonJS import
const client = new IdentitystoreClient(config);
const input = { // CreateUserRequest
  IdentityStoreId: "STRING_VALUE", // required
  UserName: "STRING_VALUE",
  Name: { // Name
    Formatted: "STRING_VALUE",
    FamilyName: "STRING_VALUE",
    GivenName: "STRING_VALUE",
    MiddleName: "STRING_VALUE",
    HonorificPrefix: "STRING_VALUE",
    HonorificSuffix: "STRING_VALUE",
  },
  DisplayName: "STRING_VALUE",
  NickName: "STRING_VALUE",
  ProfileUrl: "STRING_VALUE",
  Emails: [ // Emails
    { // Email
      Value: "STRING_VALUE",
      Type: "STRING_VALUE",
      Primary: true || false,
    },
  ],
  Addresses: [ // Addresses
    { // Address
      StreetAddress: "STRING_VALUE",
      Locality: "STRING_VALUE",
      Region: "STRING_VALUE",
      PostalCode: "STRING_VALUE",
      Country: "STRING_VALUE",
      Formatted: "STRING_VALUE",
      Type: "STRING_VALUE",
      Primary: true || false,
    },
  ],
  PhoneNumbers: [ // PhoneNumbers
    { // PhoneNumber
      Value: "STRING_VALUE",
      Type: "STRING_VALUE",
      Primary: true || false,
    },
  ],
  UserType: "STRING_VALUE",
  Title: "STRING_VALUE",
  PreferredLanguage: "STRING_VALUE",
  Locale: "STRING_VALUE",
  Timezone: "STRING_VALUE",
};
const command = new CreateUserCommand(input);
const response = await client.send(command);
// { // CreateUserResponse
//   UserId: "STRING_VALUE", // required
//   IdentityStoreId: "STRING_VALUE", // required
// };

CreateUserCommand Input

See CreateUserCommandInput for more details

Parameter
Type
Description
IdentityStoreId
Required
string | undefined

The globally unique identifier for the identity store.

Addresses
Address[] | undefined

A list of Address objects containing addresses associated with the user.

DisplayName
string | undefined

A string containing the name of the user. This value is typically formatted for display when the user is referenced. For example, "John Doe."

Emails
Email[] | undefined

A list of Email objects containing email addresses associated with the user.

Locale
string | undefined

A string containing the geographical region or location of the user.

Name
Name | undefined

An object containing the name of the user.

NickName
string | undefined

A string containing an alternate name for the user.

PhoneNumbers
PhoneNumber[] | undefined

A list of PhoneNumber objects containing phone numbers associated with the user.

PreferredLanguage
string | undefined

A string containing the preferred language of the user. For example, "American English" or "en-us."

ProfileUrl
string | undefined

A string containing a URL that might be associated with the user.

Timezone
string | undefined

A string containing the time zone of the user.

Title
string | undefined

A string containing the title of the user. Possible values are left unspecified. The value can vary based on your specific use case.

UserName
string | undefined

A unique string used to identify the user. The length limit is 128 characters. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. Administrator and AWSAdministrators are reserved names and can't be used for users or groups.

UserType
string | undefined

A string indicating the type of user. Possible values are left unspecified. The value can vary based on your specific use case.

CreateUserCommand Output

See CreateUserCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
IdentityStoreId
Required
string | undefined

The globally unique identifier for the identity store.

UserId
Required
string | undefined

The identifier of the newly created user in the identity store.

Throws

Name
Fault
Details
ConflictException
client

This request cannot be completed for one of the following reasons:

  • Performing the requested operation would violate an existing uniqueness claim in the identity store. Resolve the conflict before retrying this request.

  • The requested resource was being concurrently modified by another request.

ResourceNotFoundException
client

Indicates that a requested resource is not found.

ServiceQuotaExceededException
client

The request would cause the number of users or groups in the identity store to exceed the maximum allowed.

ValidationException
client

The request failed because it contains a syntax error.

AccessDeniedException
client

You do not have sufficient access to perform this action.

InternalServerException
server

The request processing has failed because of an unknown error, exception or failure with an internal server.

ThrottlingException
client

Indicates that the principal has crossed the throttling limits of the API operations.

IdentitystoreServiceException
Base exception class for all service exceptions from Identitystore service.