Forms

FusionAuth Reactor logo

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

API Key Authentication
Create a Form with a randomly generated Id
POST /api/form
API Key Authentication
Create a Form with the provided unique Id
POST /api/form/{formId}

Request Parameters

formIdUUIDDefaults 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.dataObject

An object that can hold any information about the Form that should be persisted.

form.nameStringrequired

The unique name of the Form.

form.stepsArray<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 or adminUser steps will be rendered as sections because there are no multi-step forms within the UI. For registration 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, where 1 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].fieldsArray<UUID>

An ordered list of Form Field Ids assigned to this step.

form.typeStringDefaults to registrationAvailable 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.

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0

Prior to version 1.20.0, the default form type was registration.

Example Request JSON

{
  "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.

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

form.dataObject

An object that can hold any information about the Form that should be persisted.

form.idUUID

The unique Id of the Form.

form.insertInstantLong

The instant that the Form was added to the FusionAuth database.

form.lastUpdateInstantLong

The instant that the Form was last updated in the FusionAuth database.

form.nameString

The unique name of the Form.

form.steps

An ordered list of objects containing one or more Form Fields.

form.steps[x].fields

An ordered list of Form Field Ids assigned to this step.

form.typeString

The form type. The possible values are:

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0

Example Response JSON

{
  "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

API Key Authentication
Retrieve all of the Forms
GET /api/form
API Key Authentication
Retrieve a Form by Id
GET /api/form/{formId}

Request Parameters

formIdUUIDrequired

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.

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

form.dataObject

An object that can hold any information about the Form that should be persisted.

form.idUUID

The unique Id of the Form.

form.insertInstantLong

The instant that the Form was added to the FusionAuth database.

form.lastUpdateInstantLong

The instant that the Form was last updated in the FusionAuth database.

form.nameString

The unique name of the Form.

form.steps

An ordered list of objects containing one or more Form Fields.

form.steps[x].fields

An ordered list of Form Field Ids assigned to this step.

form.typeString

The form type. The possible values are:

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0

Example Response JSON

{
  "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

formsArray

The list of Form objects.

forms[x].dataObject

An object that can hold any information about the Form that should be persisted.

forms[x].idUUID

The unique Id of the Form.

forms[x].insertInstantLong

The instant that the Form was added to the FusionAuth database.

forms[x].lastUpdateInstantLong

The instant that the Form was last updated in the FusionAuth database.

forms[x].nameString

The unique name of the Form.

forms[x].stepsArray<Object>

An ordered list of objects containing one or more Form Fields.

forms[x].steps[x].fieldsArray<UUID>

An ordered list of Form Field Id’s assigned to this step.

forms[x].typeString

The Form type. The possible values are:

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0#

Example Response JSON

{
  "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 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

API Key Authentication
Update the Form with the given Id
PUT /api/form/{formId}
PATCH /api/form/{formId}

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

formIdUUIDrequired

The Id of the Form to update.

Request Body

form.dataObject

An object that can hold any information about the Form that should be persisted.

form.nameStringrequired

The unique name of the Form.

form.stepsArray<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 or adminUser steps will be rendered as sections because there are no multi-step forms within the UI. For registration 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, where 1 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].fieldsArray<UUID>

An ordered list of Form Field Ids assigned to this step.

form.typeStringDefaults to registrationAvailable 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.

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0

Prior to version 1.20.0, the default form type was registration.

Example Request JSON

{
  "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.

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

form.dataObject

An object that can hold any information about the Form that should be persisted.

form.idUUID

The unique Id of the Form.

form.insertInstantLong

The instant that the Form was added to the FusionAuth database.

form.lastUpdateInstantLong

The instant that the Form was last updated in the FusionAuth database.

form.nameString

The unique name of the Form.

form.steps

An ordered list of objects containing one or more Form Fields.

form.steps[x].fields

An ordered list of Form Field Ids assigned to this step.

form.typeString

The form type. The possible values are:

  • adminRegistration - This form can 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
  • registration - This form can be used for self service registration.
  • selfServiceUser - This form can be used for Self Service Account Management. Available since 1.26.0

Example Response JSON

{
  "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

API Key Authentication
Delete a Form by Id
DELETE /api/form/{formId}

Request Parameters

formIdUUIDrequired

The unique Id of the Form 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.