Form Fields
This feature is only available in paid plans. Please visit our pricing page to learn more.
Overview
A FusionAuth Form Field is an object that can be customized to receive input within a FusionAuth Form.
The following APIs are provided to manage Forms Fields.
Create a Form Field
This API is used to create a new Form Field.
Request
Request Parameters
fieldIdUUIDDefaults to secure random UUIDThe Id to use for the new Form Field. If not specified a secure random UUID will be generated.
Request Body
field.confirmBooleanDefaults to falseDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
field.consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
field.controlStringDefaults to textThe Form Field control. The possible values are:
checkboxnumberpasswordradioselecttextareatext
text. For all managed fields, such as user.firstName, the control will be set by FusionAuth and it may not be modified.field.dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
field.descriptionStringA description of the Form Field.
field.keyStringrequiredThe key is the path to the value in the user or registration object.
Predefined keys
Predefined keys are typed values managed by FusionAuth. When using a pre-defined key, the field data type and form control are not configurable.
registration.preferredLanguagesAvailable since 1.20.0registration.rolesAvailable since 1.20.0registration.timezoneAvailable since 1.20.0registration.usernameuser.birthDateuser.emailuser.firstnameuser.fullNameuser.imageUrlAvailable since 1.20.0user.lastNameuser.middleNameuser.mobilePhoneuser.passworduser.phoneNumberAvailable since 1.59.0user.preferredLanguagesAvailable since 1.20.0user.timezoneAvailable since 1.20.0user.username
Custom Keys
When defining a key to store custom data, you may use one of the following prefixes:
user.data.registration.data.
For example, in order to store a custom value on the user object to collect the User’s favorite color, set the key value equal to user.data.favoriteColor.
A valid key name must not contain spaces or special characters. An array may be specified by using the array syntax of [0] to indicate the first position in an array. Nested objects may be specified by using the object syntax of ['foo'] to indicate the named property of the object named foo. Consider the following examples:
user.data.preferences[0]would store the value in the first position of an array namedpreferences.user.data.preferences['color']would store the value in an object namedpreferenceswith a key ofcolor.
Localization
You may localize the displayed value of this key during registration by adding the key to your theme.
For example, if you specify the key value of user.data.favoriteColor this key value be rendered in the UI.
If you were to add the following messages to your theme, the localized form of the value will be shown to the end user. This allows you to provide a human readable field name and optionally localize the field name as well.
user.data.favoriteColor=Favorite color
field.nameStringrequiredThe unique name of the Form Field.
field.optionsArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
field.requiredBooleanDefaults to falseDetermines if a value is required to complete the form.
field.typeStringDefaults to stringThe data type used to store the value in FusionAuth. The possible values are:
boolthe value must be a boolean value,trueorfalseconsentthe value will be used to complete self consentdatethe value will be stored as a date. The value must be formatted as ISO-8601 orYYY-MM-DD, you may want to use a JavaScript data picker that can convert the selected value to this format.emailthe value will be expected to be a valid email addressnumberthe value will be stored as a numerical valuestringthe value will be stored as a string
field.validator.enabledBooleanDefaults to falseDetermines if user input should be validated.
field.validator.expressionStringA regular expression used to validate user input. Must be a valid regular expression pattern.
See Pattern for examples and syntax.
Example Request JSON
{
"field": {
"data": {
"leftAddOn": "send"
},
"description": "Information about this custom field",
"key": "user.firstName",
"name": "Custom first-name Form Field",
"required": true
}
} Response
The response for this API contains the Form Field that was created.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
Response Body
field.confirmBooleanDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
field.consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
field.controlStringThe Form Field control. The possible values are:
checkboxnumberpasswordradioselecttextareatext
field.dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
field.descriptionStringA description of the Form Field.
field.idUUIDThe unique Id of the form field.
field.insertInstantLongThe instant that the form field was added to the FusionAuth database.
field.keyStringThe key is the path to the value in the user or registration object.
Predefined keys
Predefined keys are typed values managed by FusionAuth. When using a pre-defined key, the field data type and form control are not configurable.
registration.preferredLanguagesAvailable since 1.20.0registration.rolesAvailable since 1.20.0registration.timezoneAvailable since 1.20.0registration.usernameuser.birthDateuser.emailuser.firstnameuser.fullNameuser.imageUrlAvailable since 1.20.0user.lastNameuser.middleNameuser.mobilePhoneuser.passworduser.phoneNumberAvailable since 1.59.0user.preferredLanguagesAvailable since 1.20.0user.timezoneAvailable since 1.20.0user.username
Custom Keys
When defining a key to store custom data, you may use one of the following prefixes:
user.data.registration.data.
For example, in order to store a custom value on the user object to collect the User’s favorite color, set the key value equal to user.data.favoriteColor.
A valid key name must not contain spaces or special characters. An array may be specified by using the array syntax of [0] to indicate the first position in an array. Nested objects may be specified by using the object syntax of ['foo'] to indicate the named property of the object named foo. Consider the following examples:
user.data.preferences[0]would store the value in the first position of an array namedpreferences.user.data.preferences['color']would store the value in an object namedpreferenceswith a key ofcolor.
Localization
You may localize the displayed value of this key during registration by adding the key to your theme.
For example, if you specify the key value of user.data.favoriteColor this key value be rendered in the UI.
If you were to add the following messages to your theme, the localized form of the value will be shown to the end user. This allows you to provide a human readable field name and optionally localize the field name as well.
user.data.favoriteColor=Favorite color
field.lastUpdateInstantLongThe instant that the form field was last updated in the FusionAuth database.
field.nameStringThe unique name of the Form Field.
field.optionsArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
field.requiredBooleanDetermines if a value is required to complete the form.
field.typeStringThe data type used to store the value in FusionAuth. The possible values are:
boolthe value must be a boolean value,trueorfalseconsentthe value will be used to complete self consentdatethe value will be stored as a date. The value must be formatted as ISO-8601 orYYY-MM-DD, you may want to use a JavaScript data picker that can convert the selected value to this format.emailthe value will be expected to be a valid email addressnumberthe value will be stored as a numerical valuestringthe value will be stored as a string
field.validator.enabledBooleanDetermines if user input should be validated.
field.validator.expressionStringA regular expression used to validate user input. Must be a valid regular expression pattern.
See Pattern for examples and syntax.
Example Response JSON
{
"field": {
"confirm": false,
"control": "text",
"data": {
"leftAddOn": "send"
},
"description": "Information about this custom field",
"id": "e96f02db-4567-43a6-a876-74a3869fe94a",
"insertInstant": 1562189072183,
"key": "user.firstName",
"lastUpdateInstant": 1562189927638,
"name": "Custom first-name Form Field",
"required": true,
"type": "string",
"validator": {
"enabled": false
}
}
} Retrieve a Form Field
This API is used to retrieve a single Form Field by unique Id or all of the configured Form Fields.
Request
Request Parameters
fieldIdUUIDrequiredThe unique Id of the Form Field to retrieve.
Response
The response for this API contains either a single Form Field or all of the Form Fields. When you call this API with an Id, the response will contain a single Form Field. When you call this API without an Id, the response will contain all of the Form Fields. Both response types are defined below along with an example JSON response.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
| 404 | The object you requested doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
Response Body
field.confirmBooleanDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
field.consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
field.controlStringThe Form Field control. The possible values are:
checkboxnumberpasswordradioselecttextareatext
field.dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
field.descriptionStringA description of the Form Field.
field.idUUIDThe unique Id of the form field.
field.insertInstantLongThe instant that the form field was added to the FusionAuth database.
field.keyStringThe key is the path to the value in the user or registration object.
Predefined keys
Predefined keys are typed values managed by FusionAuth. When using a pre-defined key, the field data type and form control are not configurable.
registration.preferredLanguagesAvailable since 1.20.0registration.rolesAvailable since 1.20.0registration.timezoneAvailable since 1.20.0registration.usernameuser.birthDateuser.emailuser.firstnameuser.fullNameuser.imageUrlAvailable since 1.20.0user.lastNameuser.middleNameuser.mobilePhoneuser.passworduser.phoneNumberAvailable since 1.59.0user.preferredLanguagesAvailable since 1.20.0user.timezoneAvailable since 1.20.0user.username
Custom Keys
When defining a key to store custom data, you may use one of the following prefixes:
user.data.registration.data.
For example, in order to store a custom value on the user object to collect the User’s favorite color, set the key value equal to user.data.favoriteColor.
A valid key name must not contain spaces or special characters. An array may be specified by using the array syntax of [0] to indicate the first position in an array. Nested objects may be specified by using the object syntax of ['foo'] to indicate the named property of the object named foo. Consider the following examples:
user.data.preferences[0]would store the value in the first position of an array namedpreferences.user.data.preferences['color']would store the value in an object namedpreferenceswith a key ofcolor.
Localization
You may localize the displayed value of this key during registration by adding the key to your theme.
For example, if you specify the key value of user.data.favoriteColor this key value be rendered in the UI.
If you were to add the following messages to your theme, the localized form of the value will be shown to the end user. This allows you to provide a human readable field name and optionally localize the field name as well.
user.data.favoriteColor=Favorite color
field.lastUpdateInstantLongThe instant that the form field was last updated in the FusionAuth database.
field.nameStringThe unique name of the Form Field.
field.optionsArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
field.requiredBooleanDetermines if a value is required to complete the form.
field.typeStringThe data type used to store the value in FusionAuth. The possible values are:
boolthe value must be a boolean value,trueorfalseconsentthe value will be used to complete self consentdatethe value will be stored as a date. The value must be formatted as ISO-8601 orYYY-MM-DD, you may want to use a JavaScript data picker that can convert the selected value to this format.emailthe value will be expected to be a valid email addressnumberthe value will be stored as a numerical valuestringthe value will be stored as a string
field.validator.enabledBooleanDetermines if user input should be validated.
field.validator.expressionStringA regular expression used to validate user input. Must be a valid regular expression pattern.
See Pattern for examples and syntax.
Example Response JSON
{
"field": {
"confirm": false,
"control": "text",
"data": {
"leftAddOn": "send"
},
"description": "Information about this custom field",
"id": "e96f02db-4567-43a6-a876-74a3869fe94a",
"insertInstant": 1562189072183,
"key": "user.firstName",
"lastUpdateInstant": 1562189927638,
"name": "Custom first-name Form Field",
"required": true,
"type": "string",
"validator": {
"enabled": false
}
}
} Response Body
fieldsArrayThe list of Form Field objects.
fields[x].confirmBooleanDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
fields[x].consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
fields[x].controlStringThe Form Field control. The possible values are:
checkboxnumberpasswordradioselecttextareatext
fields[x].dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
fields[x].descriptionStringA description of the Form Field.
fields[x].idUUIDThe unique Id of the form field.
fields[x].inseertInstantLongThe instant that the Form Field was added to the FusionAuth database.
fields[x].keyStringThe key is the path to the value in the user or registration object.
Predefined keys
Predefined keys are typed values managed by FusionAuth. When using a pre-defined key, the field data type and form control are not configurable.
registration.preferredLanguagesAvailable since 1.20.0registration.rolesAvailable since 1.20.0registration.timezoneAvailable since 1.20.0registration.usernameuser.birthDateuser.emailuser.firstnameuser.fullNameuser.imageUrlAvailable since 1.20.0user.lastNameuser.middleNameuser.mobilePhoneuser.passworduser.phoneNumberAvailable since 1.59.0user.preferredLanguagesAvailable since 1.20.0user.timezoneAvailable since 1.20.0user.username
Custom Keys
When defining a key to store custom data, you may use one of the following prefixes:
user.data.registration.data.
For example, in order to store a custom value on the user object to collect the User’s favorite color, set the key value equal to user.data.favoriteColor.
A valid key name must not contain spaces or special characters. An array may be specified by using the array syntax of [0] to indicate the first position in an array. Nested objects may be specified by using the object syntax of ['foo'] to indicate the named property of the object named foo. Consider the following examples:
user.data.preferences[0]would store the value in the first position of an array namedpreferences.user.data.preferences['color']would store the value in an object namedpreferenceswith a key ofcolor.
Localization
You may localize the displayed value of this key during registration by adding the key to your theme.
For example, if you specify the key value of user.data.favoriteColor this key value be rendered in the UI.
If you were to add the following messages to your theme, the localized form of the value will be shown to the end user. This allows you to provide a human readable field name and optionally localize the field name as well.
user.data.favoriteColor=Favorite color
fields[x].lastUpdateInstantLongThe instant that the form field was last updated in the FusionAuth database.
fields[x].nameStringThe unique name of the Form Field.
fields[x].confirmArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
fields[x].requiredBooleanDetermines if a value is required to complete the form.
fields[x].typeStringThe data type used to store the value in FusionAuth. The possible values are:
boolthe value must be a boolean value,trueorfalseconsentthe value will be used to complete self consentdatethe value will be stored as a date. The value must be formatted as ISO-8601 orYYY-MM-DD, you may want to use a JavaScript data picker that can convert the selected value to this format.emailthe value will be expected to be a valid email addressnumberthe value will be stored as a numerical valuestringthe value will be stored as a string
fields[x].validator.enabledBooleanDetermines if user input should be validated.
fields[x].validator.expressionStringA regular expression used to validate user input.
Example Response JSON
{
"fields": [
{
"confirm": false,
"control": "text",
"data": {
"leftAddOn": "send"
},
"description": "Information about this custom field",
"id": "e96f02db-4567-43a6-a876-74a3869fe94a",
"insertInstant": 1562189072183,
"key": "user.firstName",
"lastUpdateInstant": 1562189927638,
"name": "Custom first-name Form Field",
"required": true,
"type": "string",
"validator": {
"enabled": false
}
}
]
} Update a Form Field
This API is used to update an existing Form Field.
You must specify all of the properties of the Form Field when calling this API with the PUT HTTP method. When used with PUT, this API doesn’t merge the existing Form Field and your new data. It replaces the existing Form Field with your new data.
Utilize the PATCH HTTP method to send specific changes to merge into an existing Form Field.
Some attributes, such as type , cannot be changed after form field creation.
Request
When using the PATCH method, you can either use the same request body documentation that is provided for the PUT request for backward compatibility. Or you may use either JSON Patch/RFC 6902] or JSON Merge Patch/RFC 7396. See the PATCH documentation for more information.
When using the PATCH method with a Content-Type of application/json the provided request parameters will be merged into the existing object, this means all parameters are optional when using the PATCH method and you only provide the values you want changed. A null value can be used to remove a value. Patching an Array will result in all values from the new list being appended to the existing list, this is a known limitation to the current implementation of PATCH.
Request Parameters
fieldIdUUIDrequiredThe Id of the Form Field to update.
Request Body
field.confirmBooleanDefaults to falseDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
field.consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
field.dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
field.descriptionStringA description of the Form Field.
field.nameStringrequiredThe unique name of the Form Field.
field.optionsArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
field.requiredBooleanDefaults to falseDetermines if a value is required to complete the form.
field.validator.enabledBooleanDefaults to falseDetermines if user input should be validated.
field.validator.expressionStringA regular expression used to validate user input. Must be a valid regular expression pattern.
See Pattern for examples and syntax.
Example Request JSON
{
"field": {
"data": {
"leftAddOn": "send"
},
"description": "Updated information about this custom field",
"name": "Custom, updated, first-name Form Field",
"required": false
}
} Response
The response for this API contains the Form Field that was updated.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
Response Body
field.confirmBooleanDetermines if the user input should be confirmed by requiring the value to be entered twice. If true, a confirmation field is included.
field.consentIdUUIDThe Id of an existing Consent. This field will be required when the type is set to consent.
Using a form field for consent allows you to leverage a FusionAuth consent to allow your end users to self consent to terms and service, end user license agreements, or other opt-in, or opt-out agreements during registration.
field.controlStringThe Form Field control. The possible values are:
checkboxnumberpasswordradioselecttextareatext
field.dataObjectAn object that can hold any information about the Form Field that should be persisted.
This may be useful to add additional meta data to the field that will help you style or render the Form Field. For example, in the JSON example an attribute is added to this data field as follows:
{
"data": {
"leftAddOn": "user"
}
}
This additional meta data is then used to render an icon on the Form Field. Use of this additional data is optional and not required to render the field.
field.descriptionStringA description of the Form Field.
field.idUUIDThe unique Id of the form field.
field.insertInstantLongThe instant that the form field was added to the FusionAuth database.
field.keyStringThe key is the path to the value in the user or registration object.
Predefined keys
Predefined keys are typed values managed by FusionAuth. When using a pre-defined key, the field data type and form control are not configurable.
registration.preferredLanguagesAvailable since 1.20.0registration.rolesAvailable since 1.20.0registration.timezoneAvailable since 1.20.0registration.usernameuser.birthDateuser.emailuser.firstnameuser.fullNameuser.imageUrlAvailable since 1.20.0user.lastNameuser.middleNameuser.mobilePhoneuser.passworduser.phoneNumberAvailable since 1.59.0user.preferredLanguagesAvailable since 1.20.0user.timezoneAvailable since 1.20.0user.username
Custom Keys
When defining a key to store custom data, you may use one of the following prefixes:
user.data.registration.data.
For example, in order to store a custom value on the user object to collect the User’s favorite color, set the key value equal to user.data.favoriteColor.
A valid key name must not contain spaces or special characters. An array may be specified by using the array syntax of [0] to indicate the first position in an array. Nested objects may be specified by using the object syntax of ['foo'] to indicate the named property of the object named foo. Consider the following examples:
user.data.preferences[0]would store the value in the first position of an array namedpreferences.user.data.preferences['color']would store the value in an object namedpreferenceswith a key ofcolor.
Localization
You may localize the displayed value of this key during registration by adding the key to your theme.
For example, if you specify the key value of user.data.favoriteColor this key value be rendered in the UI.
If you were to add the following messages to your theme, the localized form of the value will be shown to the end user. This allows you to provide a human readable field name and optionally localize the field name as well.
user.data.favoriteColor=Favorite color
field.lastUpdateInstantLongThe instant that the form field was last updated in the FusionAuth database.
field.nameStringThe unique name of the Form Field.
field.optionsArray<String>A list of options that are applied to checkbox, radio, or select controls.
The options for a field must conform to the field.type . If the field.type is number, the options must be numbers. If the field.type is boolean, only true and/or false are allowed.
You may localize the displayed values during registration by adding these values to your theme.
For example, if you specify the values ["red", "green", "blue"] as the field options, these will be stored on the user in this lowercase form. By default the values red, green and blue will be rendered in the UI.
If you were to add the following messages to your theme, the capitalized form of the values will be shown to the end user. This allows you to provide a human-readable form of the value and optionally localize the displayed values.
Default
red=Red
green=Green
blue=Blue
Spanish
red=Roja
green=Verde
blue=Azul
field.requiredBooleanDetermines if a value is required to complete the form.
field.typeStringThe data type used to store the value in FusionAuth. The possible values are:
boolthe value must be a boolean value,trueorfalseconsentthe value will be used to complete self consentdatethe value will be stored as a date. The value must be formatted as ISO-8601 orYYY-MM-DD, you may want to use a JavaScript data picker that can convert the selected value to this format.emailthe value will be expected to be a valid email addressnumberthe value will be stored as a numerical valuestringthe value will be stored as a string
field.validator.enabledBooleanDetermines if user input should be validated.
field.validator.expressionStringA regular expression used to validate user input. Must be a valid regular expression pattern.
See Pattern for examples and syntax.
Example Response JSON
{
"field": {
"confirm": false,
"control": "text",
"data": {
"leftAddOn": "send"
},
"description": "Information about this custom field",
"id": "e96f02db-4567-43a6-a876-74a3869fe94a",
"insertInstant": 1562189072183,
"key": "user.firstName",
"lastUpdateInstant": 1562189927638,
"name": "Custom first-name Form Field",
"required": true,
"type": "string",
"validator": {
"enabled": false
}
}
} Delete a Form Field
This API is used to permanently delete a Form Field. A form field cannot be deleted when in use by a one or more forms.
Request
Request Parameters
fieldIdUUIDrequiredThe unique Id of the Form Field to delete.
Response
This API does not return a JSON response body.
Response Codes| Code | Description |
|---|---|
| 200 | The request was successful. |
| 400 | The request was invalid and/or malformed. The response will contain an Errors JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See Authentication. |
| 404 | The object you requested doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |