Skip to main content
Skip table of contents

Create new User

The Create new User operation creates a new user in Keycloak. The data is defined in the input XML expected by the adapter.

Input XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<User>
	<Username></Username>
	<FirstName></FirstName>
	<LastName></LastName>
	<Email></Email>
	<EmailVerified></EmailVerified>
	<Enabled></Enabled>
	<Attributes>
		<Attribute>
			<Name></Name>
			<Values>
				<Value></Value>
			</Values>
		</Attribute>
	</Attributes>
	<Credentials>
		<Credential>
			<Type></Type>
			<Value></Value>
			<Temporary></Temporary>
		</Credential>
	</Credentials>
</User>

User

ElementDescriptionPossible values
User

The element contains the following elements:

  • Username
  • FirstName (optional)
  • LastName (optional)
  • Email (optional)
  • EmailVerified (optional)
  • Enabled (optional)
  • Attributes (optional)
  • Credentials (optional)
UsernameThe user name desired by the userAny string
FirstNameThe first name of the userAny string
LastNameThe last name of the userAny string
EmailThe email address of the userEmail address
EmailVerified

Specifies whether the specified email address is verified.

  • true: The email address is verified.
  • false: The email address is not verified.
EnabledSpecifies whether the user is enabled or disabled
  • true: The user is enabled.
  • false: The user is disabled.
Attributes

Personalized, configurable attributes

The element contains the following elements:

  • Attribute (Multiple declaration possible)
Credentials

User credentials

The element contains the following element:

  • Credential

Attributes

ElementDescription
AttributesPersonalized, configurable attributes

The element contains the following elements:

  • Attribute (Multiple declaration possible)
Attribute

Personalized, configurable attribute

The element contains the following elements:

  • Name
  • Values
NameAttribute nameAny string
Values

Attribute values

The element contains the following elements:

  • Value (Multiple declaration possible)
ValueAttribute valueAny string

Credentials

The Credentials element defines the type of credential and the associated value. This can be a password, for example.

ElementDescriptionPossible values
CredentialsUser credentials

The element contains the following elements:

  • Credential
CredentialLogin data set

The element contains the following elements:

  • Type
  • Value
  • Temporary
TypeType of login data set, e.g. password

password: The login data set is a password.

ValueAttribute valueAny string
Temporary

Specifies whether the password is temporary

true: The password is temporary.

false: The password is not temporary.

XSD

XML
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
	<xs:element name="User">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="Username"/>
				<xs:element ref="FirstName"/>
				<xs:element ref="LastName"/>
				<xs:element ref="Email"/>
				<xs:element ref="EmailVerified"/>
				<xs:element ref="Enabled"/>
				<xs:element ref="Attributes"/>
				<xs:element ref="Credentials"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Username" type="xs:NCName"/>
	<xs:element name="FirstName" type="xs:NCName"/>
	<xs:element name="LastName" type="xs:NCName"/>
	<xs:element name="Email" type="xs:string"/>
	<xs:element name="EmailVerified" type="xs:boolean"/>
	<xs:element name="Enabled" type="xs:boolean"/>
	<xs:element name="Attributes">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="Attribute"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Attribute">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="Name"/>
				<xs:element ref="Values"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Name" type="xs:string"/>
	<xs:element name="Values">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="Value"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Credentials">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="Credential"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Credential">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="Type"/>
				<xs:element ref="Value"/>
				<xs:element ref="Temporary"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="Type" type="xs:NCName"/>
	<xs:element name="Temporary" type="xs:boolean"/>
	<xs:element name="Value" type="xs:string"/>
</xs:schema>

Examples

Input

XML
<?xml version="1.0" encoding="UTF-8"?>
<User>
	<Username>JohnDoe</Username>
	<FirstName>John</FirstName>
	<LastName>Doe</LastName>
	<Email>John.Doe@example.com</Email>
	<EmailVerified>true</EmailVerified>
	<Enabled>true</Enabled>
	<Attributes>
		<Attribute>
			<Name>Employment Relationship</Name>
			<Values>
				<Value>Software Developer</Value>
				<Value>Sub-Team Lead</Value>
			</Values>
		</Attribute>
	</Attributes>
	<Credentials>
		<Credential>
			<Type>password</Type>
			<Value>password123</Value>
			<Temporary>false</Temporary>
		</Credential>
	</Credentials>
</User>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.