Form APIs
This feature is only available in paid plans. Please visit our pricing page to learn more.
Overview
A FusionAuth Form is a customizable object that contains one-to-many ordered steps. Each step is comprised of one or more Form Fields.
The following APIs are provided to manage Forms.
Create a Form
This API is used to create a new Form.
Request
Create a Form with a randomly generated Id
POST /api/form
Create a Form with the provided unique Id
POST /api/form/{formId}
Request Parameters
- formId [UUID] Optional defaults to secure random UUID
-
The Id to use for the new Form. If not specified a secure random UUID will be generated.
Request Body
- form.data [Object] Optional
-
An object that can hold any information about the Form that should be persisted.
- form.name [String] Required
-
The unique name of the Form.
- form.steps [Array<Object>] Required
-
An ordered list of objects containing one or more Form Fields. A Form must have at least one step defined.
Steps manifest in two different ways. When the form type is
adminRegistration
oradminUser
steps will be rendered assections
because there are no multi-step forms within the UI. Forregistration
each step will be considered a step within a multi-step form.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-form-section}1
this key value be rendered in the UI, where1
specifies the section number to adjust the value of.Adding the following message to your theme will cause the first section of the User add or edit form to be rendered as "Optionally name me!". This feature allows you to customize and optionally localize each section heading within the User form.
{user-form-section}1=Optionally name me!
You may optionally provide a specific label per tenant by prefixing the value the with the tenant Id as follows:
[cbeaf8fe-f4a7-4a27-9f77-c609f1b01856]{user-form-section}2=Tenant specific label for section 2
You may also optionally provide a specific label per application for a registration form by prefixing the value the with the application Id as follows:
[cfb5fab7-b3b6-41bb-adfa-d23ac83a96e5]{registration-form-section}2=Application specific label for section 2
- form.steps
[x]
.fields [Array<UUID>] -
An ordered list of Form Field Ids assigned to this step.
- form.type [String] Optional defaults to
registration
Available since 1.20.0 -
The type of form being created, a form type cannot be changed after the form has been created. This type will be used to identify how this form can be utilized by FusionAuth.
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
Prior to version
1.20.0
, the default form type wasregistration
. -
{
"form": {
"data": {
"description": "This form customizes the registration experience."
},
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
]
}
}
Response
The response for this API contains the Form that was created.
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
- form.data [Object]
-
An object that can hold any information about the Form that should be persisted.
- form.id [UUID]
-
The unique Id of the Form.
- form.insertInstant [Long]
-
The instant that the Form was added to the FusionAuth database.
- form.lastUpdateInstant [Long]
-
The instant that the Form was last updated in the FusionAuth database.
- form.name [String]
-
The unique name of the Form.
- form.steps [Array<Object>]
-
An ordered list of objects containing one or more Form Fields.
- form.steps
[x]
.fields [Array<UUID>] -
An ordered list of Form Field Ids assigned to this step.
- form.type [String]
-
The form type. The possible values are:
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
-
{
"form": {
"data": {
"description": "This form customizes the registration experience."
},
"id": "1188edfc-cef3-4555-910e-181ddf6153c0",
"insertInstant": 1562189072183,
"lastUpdateInstant": 1562189072183,
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
],
"type": "registration"
}
}
Retrieve a Form
This API is used to retrieve a single Form by unique Id or all of the configured Forms.
Request
GET /api/form
GET /api/form/{formId}
Request Parameters
- formId [UUID] Required
-
The unique Id of the Form to retrieve.
Response
The response for this API contains either a single Form or all of the Forms. When you call this API with an Id, the response will contain a single Form. When you call this API without an Id, the response will contain all of the Forms. Both response types are defined below along with an example JSON response.
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
- form.data [Object]
-
An object that can hold any information about the Form that should be persisted.
- form.id [UUID]
-
The unique Id of the Form.
- form.insertInstant [Long]
-
The instant that the Form was added to the FusionAuth database.
- form.lastUpdateInstant [Long]
-
The instant that the Form was last updated in the FusionAuth database.
- form.name [String]
-
The unique name of the Form.
- form.steps [Array<Object>]
-
An ordered list of objects containing one or more Form Fields.
- form.steps
[x]
.fields [Array<UUID>] -
An ordered list of Form Field Ids assigned to this step.
- form.type [String]
-
The form type. The possible values are:
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
-
{
"form": {
"data": {
"description": "This form customizes the registration experience."
},
"id": "1188edfc-cef3-4555-910e-181ddf6153c0",
"insertInstant": 1562189072183,
"lastUpdateInstant": 1562189072183,
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
],
"type": "registration"
}
}
Response Body
- forms [Array]
-
The list of Form objects.
- forms
[x]
.data [Object] -
An object that can hold any information about the Form that should be persisted.
- forms
[x]
.id [UUID] -
The unique Id of the Form.
- forms
[x]
.insertInstant [Long] -
The instant that the Form was added to the FusionAuth database.
- forms
[x]
.lastUpdateInstant [Long] -
The instant that the Form was last updated in the FusionAuth database.
- forms
[x]
.name [String] -
The unique name of the Form.
- forms
[x]
.steps [Array<Object>] -
An ordered list of objects containing one or more Form Fields.
- forms
[x]
.steps[x]
.fields [Array<UUID>] -
An ordered list of Form Field Id’s assigned to this step.
- forms
[x]
.type [String] -
The Form type. The possible values are:
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
-
{
"forms": [
{
"data": {
"description": "This form customizes the registration experience."
},
"id": "1188edfc-cef3-4555-910e-181ddf6153c0",
"insertInstant": 1562189072183,
"lastUpdateInstant": 1562189072183,
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
],
"type": "registration"
}
]
}
Update a Form
This API is used to update an existing Form.
You must specify the Id of the Form you are updating on the URI.
You must specify all of the properties of the Form when calling this API with the PUT
HTTP method. When used with PUT
, this API doesn’t merge the existing Form and your new data. It replaces the existing Form with your new data.
Utilize the PATCH
HTTP method to send specific changes to merge into an existing Form.
Request
Update the Form with the given Id
PUT /api/form/{formId}
PATCH /api/form/{formId}
Available since 1.39.0
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.Available since 1.12.0
When using the PATCH method, use the same request body documentation that is provided for the PUT request. The PATCH method will merge the provided request parameters 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 anArray
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
- formId [UUID] Required
-
The Id of the Form to update.
Request Body
- form.data [Object] Optional
-
An object that can hold any information about the Form that should be persisted.
- form.name [String] Required
-
The unique name of the Form.
- form.steps [Array<Object>] Required
-
An ordered list of objects containing one or more Form Fields. A Form must have at least one step defined.
Steps manifest in two different ways. When the form type is
adminRegistration
oradminUser
steps will be rendered assections
because there are no multi-step forms within the UI. Forregistration
each step will be considered a step within a multi-step form.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-form-section}1
this key value be rendered in the UI, where1
specifies the section number to adjust the value of.Adding the following message to your theme will cause the first section of the User add or edit form to be rendered as "Optionally name me!". This feature allows you to customize and optionally localize each section heading within the User form.
{user-form-section}1=Optionally name me!
You may optionally provide a specific label per tenant by prefixing the value the with the tenant Id as follows:
[cbeaf8fe-f4a7-4a27-9f77-c609f1b01856]{user-form-section}2=Tenant specific label for section 2
You may also optionally provide a specific label per application for a registration form by prefixing the value the with the application Id as follows:
[cfb5fab7-b3b6-41bb-adfa-d23ac83a96e5]{registration-form-section}2=Application specific label for section 2
- form.steps
[x]
.fields [Array<UUID>] -
An ordered list of Form Field Ids assigned to this step.
- form.type [String] Optional defaults to
registration
Available since 1.20.0 -
The type of form being created, a form type cannot be changed after the form has been created. This type will be used to identify how this form can be utilized by FusionAuth.
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
Prior to version
1.20.0
, the default form type wasregistration
. -
{
"form": {
"data": {
"description": "This form customizes the registration experience."
},
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
]
}
}
Response
The response for this API contains the Form that was updated.
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
- form.data [Object]
-
An object that can hold any information about the Form that should be persisted.
- form.id [UUID]
-
The unique Id of the Form.
- form.insertInstant [Long]
-
The instant that the Form was added to the FusionAuth database.
- form.lastUpdateInstant [Long]
-
The instant that the Form was last updated in the FusionAuth database.
- form.name [String]
-
The unique name of the Form.
- form.steps [Array<Object>]
-
An ordered list of objects containing one or more Form Fields.
- form.steps
[x]
.fields [Array<UUID>] -
An ordered list of Form Field Ids assigned to this step.
- form.type [String]
-
The form type. The possible values are:
-
registration
- This form will be used for self service registration. -
adminRegistration
- This form be used to customize the add and edit User Registration form in the FusionAuth UI. Available since 1.20.0 -
adminUser
- This form can be used to customize the add and edit User form in the FusionAuth UI. Available since 1.20.0
-
{
"form": {
"data": {
"description": "This form customizes the registration experience."
},
"id": "1188edfc-cef3-4555-910e-181ddf6153c0",
"insertInstant": 1562189072183,
"lastUpdateInstant": 1562189072183,
"name": "Custom Registration Form",
"steps": [
{
"fields": [
"68259c40-0b4e-4245-8956-7e5af0959c2b",
"00f24e72-52e2-4f55-8ea1-6a06bfe10df5"
]
},
{
"fields": [
"11a5b1b8-7ef5-476f-af7d-69e19796fa8b"
]
}
],
"type": "registration"
}
}
Delete a Form
This API is used to permanently delete a Form. A form cannot be deleted when in use by one or more applications.
Request
DELETE /api/form/{formId}
Request Parameters
- formId [UUID] Required
-
The unique Id of the Form to delete.
Response
This API does not return a JSON response body.
Code | Description |
---|---|
200 |
The request was successful. The response will be empty. |
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 delete 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. |
Feedback
How helpful was this page?
See a problem?
File an issue in our docs repo
Have a question or comment to share?
Visit the FusionAuth community forum.