add_custom_attributes

CognitoIdentityProvider.Client.add_custom_attributes(**kwargs)

Adds additional user attributes to the user pool schema.

See also: AWS API Documentation

Request Syntax

response = client.add_custom_attributes(
    UserPoolId='string',
    CustomAttributes=[
        {
            'Name': 'string',
            'AttributeDataType': 'String'|'Number'|'DateTime'|'Boolean',
            'DeveloperOnlyAttribute': True|False,
            'Mutable': True|False,
            'Required': True|False,
            'NumberAttributeConstraints': {
                'MinValue': 'string',
                'MaxValue': 'string'
            },
            'StringAttributeConstraints': {
                'MinLength': 'string',
                'MaxLength': 'string'
            }
        },
    ]
)
Parameters
  • UserPoolId (string) --

    [REQUIRED]

    The user pool ID for the user pool where you want to add custom attributes.

  • CustomAttributes (list) --

    [REQUIRED]

    An array of custom attributes, such as Mutable and Name.

    • (dict) --

      Contains information about the schema attribute.

      • Name (string) --

        A schema attribute of the name type.

      • AttributeDataType (string) --

        The attribute data type.

      • DeveloperOnlyAttribute (boolean) --

        Note

        You should use WriteAttributes in the user pool client to control how attributes can be mutated for new use cases instead of using DeveloperOnlyAttribute .

        Specifies whether the attribute type is developer only. This attribute can only be modified by an administrator. Users won't be able to modify this attribute using their access token. For example, DeveloperOnlyAttribute can be modified using AdminUpdateUserAttributes but can't be updated using UpdateUserAttributes.

      • Mutable (boolean) --

        Specifies whether the value of the attribute can be changed.

        For any user pool attribute that is mapped to an IdP attribute, you must set this parameter to true . Amazon Cognito updates mapped attributes when users sign in to your application through an IdP. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute. For more information, see Specifying Identity Provider Attribute Mappings for Your User Pool.

      • Required (boolean) --

        Specifies whether a user pool attribute is required. If the attribute is required and the user doesn't provide a value, registration or sign-in will fail.

      • NumberAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the number type.

        • MinValue (string) --

          The minimum value of an attribute that is of the number data type.

        • MaxValue (string) --

          The maximum value of an attribute that is of the number data type.

      • StringAttributeConstraints (dict) --

        Specifies the constraints for an attribute of the string type.

        • MinLength (string) --

          The minimum length.

        • MaxLength (string) --

          The maximum length.

Return type

dict

Returns

Response Syntax

{}

Response Structure

  • (dict) --

    Represents the response from the server for the request to add custom attributes.

Exceptions

  • CognitoIdentityProvider.Client.exceptions.ResourceNotFoundException
  • CognitoIdentityProvider.Client.exceptions.InvalidParameterException
  • CognitoIdentityProvider.Client.exceptions.TooManyRequestsException
  • CognitoIdentityProvider.Client.exceptions.NotAuthorizedException
  • CognitoIdentityProvider.Client.exceptions.UserImportInProgressException
  • CognitoIdentityProvider.Client.exceptions.InternalErrorException