UpdateUserPool - Amazon Cognito
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

UpdateUserPool

Updates the specified user pool with the specified attributes. You can get a list of the current user pool settings using DescribeUserPool. If you don't provide a value for an attribute, it will be set to the default value.

Note

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Request Syntax

{ "AccountRecoverySetting": { "RecoveryMechanisms": [ { "Name": "string", "Priority": number } ] }, "AdminCreateUserConfig": { "AllowAdminCreateUserOnly": boolean, "InviteMessageTemplate": { "EmailMessage": "string", "EmailSubject": "string", "SMSMessage": "string" }, "UnusedAccountValidityDays": number }, "AutoVerifiedAttributes": [ "string" ], "DeviceConfiguration": { "ChallengeRequiredOnNewDevice": boolean, "DeviceOnlyRememberedOnUserPrompt": boolean }, "EmailConfiguration": { "ConfigurationSet": "string", "EmailSendingAccount": "string", "From": "string", "ReplyToEmailAddress": "string", "SourceArn": "string" }, "EmailVerificationMessage": "string", "EmailVerificationSubject": "string", "LambdaConfig": { "CreateAuthChallenge": "string", "CustomEmailSender": { "LambdaArn": "string", "LambdaVersion": "string" }, "CustomMessage": "string", "CustomSMSSender": { "LambdaArn": "string", "LambdaVersion": "string" }, "DefineAuthChallenge": "string", "KMSKeyID": "string", "PostAuthentication": "string", "PostConfirmation": "string", "PreAuthentication": "string", "PreSignUp": "string", "PreTokenGeneration": "string", "UserMigration": "string", "VerifyAuthChallengeResponse": "string" }, "MfaConfiguration": "string", "Policies": { "PasswordPolicy": { "MinimumLength": number, "RequireLowercase": boolean, "RequireNumbers": boolean, "RequireSymbols": boolean, "RequireUppercase": boolean, "TemporaryPasswordValidityDays": number } }, "SmsAuthenticationMessage": "string", "SmsConfiguration": { "ExternalId": "string", "SnsCallerArn": "string", "SnsRegion": "string" }, "SmsVerificationMessage": "string", "UserAttributeUpdateSettings": { "AttributesRequireVerificationBeforeUpdate": [ "string" ] }, "UserPoolAddOns": { "AdvancedSecurityMode": "string" }, "UserPoolId": "string", "UserPoolTags": { "string" : "string" }, "VerificationMessageTemplate": { "DefaultEmailOption": "string", "EmailMessage": "string", "EmailMessageByLink": "string", "EmailSubject": "string", "EmailSubjectByLink": "string", "SmsMessage": "string" } }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

AccountRecoverySetting

The available verified method a user can use to recover their password when they call ForgotPassword. You can use this setting to define a preferred method when a user has more than one method available. With this setting, SMS doesn't qualify for a valid password recovery mechanism if the user also has SMS multi-factor authentication (MFA) activated. In the absence of this setting, Amazon Cognito uses the legacy behavior to determine the recovery method where SMS is preferred through email.

Type: AccountRecoverySettingType object

Required: No

AdminCreateUserConfig

The configuration for AdminCreateUser requests.

Type: AdminCreateUserConfigType object

Required: No

AutoVerifiedAttributes

The attributes that are automatically verified when Amazon Cognito requests to update user pools.

Type: Array of strings

Valid Values: phone_number | email

Required: No

DeviceConfiguration

The device-remembering configuration for a user pool. A null value indicates that you have deactivated device remembering in your user pool.

Note

When you provide a value for any DeviceConfiguration field, you activate the Amazon Cognito device-remembering feature.

Type: DeviceConfigurationType object

Required: No

EmailConfiguration

The email configuration of your user pool. The email configuration type sets your preferred sending method, Amazon Region, and sender for email invitation and verification messages from your user pool.

Type: EmailConfigurationType object

Required: No

EmailVerificationMessage

The contents of the email verification message.

Type: String

Length Constraints: Minimum length of 6. Maximum length of 20000.

Pattern: [\p{L}\p{M}\p{S}\p{N}\p{P}\s*]*\{####\}[\p{L}\p{M}\p{S}\p{N}\p{P}\s*]*

Required: No

EmailVerificationSubject

The subject of the email verification message.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 140.

Pattern: [\p{L}\p{M}\p{S}\p{N}\p{P}\s]+

Required: No

LambdaConfig

The Lambda configuration information from the request to update the user pool.

Type: LambdaConfigType object

Required: No

MfaConfiguration

Possible values include:

  • OFF - MFA tokens aren't required and can't be specified during user registration.

  • ON - MFA tokens are required for all user registrations. You can only specify ON when you're initially creating a user pool. You can use the SetUserPoolMfaConfig API operation to turn MFA "ON" for existing user pools.

  • OPTIONAL - Users have the option when registering to create an MFA token.

Type: String

Valid Values: OFF | ON | OPTIONAL

Required: No

Policies

A container with the policies you want to update in a user pool.

Type: UserPoolPolicyType object

Required: No

SmsAuthenticationMessage

The contents of the SMS authentication message.

Type: String

Length Constraints: Minimum length of 6. Maximum length of 140.

Pattern: .*\{####\}.*

Required: No

SmsConfiguration

The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your Amazon Web Services account through Amazon Simple Notification Service. To send SMS messages with Amazon SNS in the Amazon Region that you want, the Amazon Cognito user pool uses an Amazon Identity and Access Management (IAM) role in your Amazon Web Services account.

Type: SmsConfigurationType object

Required: No

SmsVerificationMessage

A container with information about the SMS verification message.

Type: String

Length Constraints: Minimum length of 6. Maximum length of 140.

Pattern: .*\{####\}.*

Required: No

UserAttributeUpdateSettings

The settings for updates to user attributes. These settings include the property AttributesRequireVerificationBeforeUpdate, a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to to email addresses and phone numbers.

Type: UserAttributeUpdateSettingsType object

Required: No

UserPoolAddOns

Enables advanced security risk detection. Set the key AdvancedSecurityMode to the value "AUDIT".

Type: UserPoolAddOnsType object

Required: No

UserPoolId

The user pool ID for the user pool you want to update.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 55.

Pattern: [\w-]+_[0-9a-zA-Z]+

Required: Yes

UserPoolTags

The tag keys and values to assign to the user pool. A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

Type: String to string map

Key Length Constraints: Minimum length of 1. Maximum length of 128.

Value Length Constraints: Minimum length of 0. Maximum length of 256.

Required: No

VerificationMessageTemplate

The template for verification messages.

Type: VerificationMessageTemplateType object

Required: No

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

ConcurrentModificationException

This exception is thrown if two or more modifications are happening concurrently.

HTTP Status Code: 400

InternalErrorException

This exception is thrown when Amazon Cognito encounters an internal error.

HTTP Status Code: 500

InvalidEmailRoleAccessPolicyException

This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.

HTTP Status Code: 400

InvalidParameterException

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

HTTP Status Code: 400

InvalidSmsRoleAccessPolicyException

This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

HTTP Status Code: 400

InvalidSmsRoleTrustRelationshipException

This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

HTTP Status Code: 400

NotAuthorizedException

This exception is thrown when a user isn't authorized.

HTTP Status Code: 400

ResourceNotFoundException

This exception is thrown when the Amazon Cognito service can't find the requested resource.

HTTP Status Code: 400

TooManyRequestsException

This exception is thrown when the user has made too many requests for a given operation.

HTTP Status Code: 400

UserImportInProgressException

This exception is thrown when you're trying to modify a user pool while a user import job is in progress for that pool.

HTTP Status Code: 400

UserPoolTaggingException

This exception is thrown when a user pool tag can't be set or updated.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: