> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Form API | FusionAuth Docs

Learn about the APIs for creating, retrieving, updating and deleting forms.

# Form API

[Edit on GitHub](https://github.com/FusionAuth/fusionauth-site/blob/main/astro/src/content/docs/apis/custom-forms/forms.mdx)

[View Markdown](https://fusionauth.io/docs/apis/custom-forms/forms.md)

This feature is only available in paid plans. To learn more, see [our pricing page](https://fusionauth.io/pricing.md).

A FusionAuth Form is a customizable object that contains one-to-many ordered steps. Each step is comprised of one or more [Form Fields](https://fusionauth.io/docs/apis/custom-forms/form-fields.md).

The following APIs are provided to manage Forms.

## Create a Form

This API is used to create a new Form.

### Request

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Create a Form with a randomly generated Id

POST/api/form

OpenAPI Spec

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Create a Form with the provided unique Id

POST/api/form/{formId}

OpenAPI Spec

#### Request Parameters

`formId`UUIDoptionalDefaults 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`Objectoptional

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

`form.name`Stringrequired

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` or `adminUser` steps will be rendered as `sections` because there are no multi-step forms within the admin 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.

```plaintext
{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:

```plaintext
[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:

```plaintext
[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.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

The possible values are:

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber` - Perform verification on **user.phoneNumber** before user creation.

*   `verifyEmail` and `verifyPhoneNumber` are only valid when **form.type** is `registration`.
*   When using the `verify*` step types, if the form includes a `user.password` field, that field must be AFTER the last `verify*` step.
*   If `verifyEmail` is used, **user.email** must be included on a step prior to the `verifyEmail` step.
*   If `verifyPhoneNumber` is used, **user.phoneNumber** must be included on a step prior to the `verifyPhoneNumber` step.

`form.type`StringoptionalDefaults 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 admin UI. Available since 1.20.0
*   `adminUser` - This form can be used to customize the add and edit User form in the FusionAuth admin 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*

```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"
        ],
        "type": "collectData"
      },
      {
        "fields": [],
        "type": "verifyEmail"
      },
      {
        "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](https://fusionauth.io/docs/apis/errors.md) 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](https://fusionauth.io/docs/apis/authentication.md). |
| 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](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was added to the FusionAuth database.

`form.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was last updated in the FusionAuth database.

`form.name`String

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.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber`\- Perform verification on **user.phoneNumber** before user creation.

`form.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

The possible values are:

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber` - Perform verification on **user.phoneNumber** before user creation.

`form.type`String

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 admin UI. Available since 1.20.0
*   `adminUser` - This form can be used to customize the add and edit User form in the FusionAuth admin 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](https://fusionauth.io/docs/lifecycle/manage-users/account-management.md). Available since 1.26.0

*Example Response JSON*

```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

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Retrieve all of the Forms

GET/api/form

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Retrieve a Form by Id

GET/api/form/{formId}

OpenAPI Spec

#### Request Parameters

`formId`UUIDrequired

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](https://fusionauth.io/docs/apis/errors.md) 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](https://fusionauth.io/docs/apis/authentication.md). |
| 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](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was added to the FusionAuth database.

`form.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was last updated in the FusionAuth database.

`form.name`String

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.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber`\- Perform verification on **user.phoneNumber** before user creation.

`form.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

The possible values are:

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber` - Perform verification on **user.phoneNumber** before user creation.

`form.type`String

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 admin UI. Available since 1.20.0
*   `adminUser` - This form can be used to customize the add and edit User form in the FusionAuth admin 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](https://fusionauth.io/docs/lifecycle/manage-users/account-management.md). Available since 1.26.0

*Example Response JSON*

```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

`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](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was added to the FusionAuth database.

`forms[x].lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) 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:

*   `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*

```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

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Update the Form with the given Id

PUT/api/form/{formId}

OpenAPI Spec

PATCH/api/form/{formId}

OpenAPI Spec

For backward compatibility, the `PATCH` method accepts the same media type (specified by a `Content-Type` of `application/json`) and body as the `PUT` request. You can also use the following media types for different behavior:

*   [JSON Patch/RFC 6902](https://www.rfc-editor.org/rfc/rfc6902): `application/json-patch+json`
*   [JSON Merge Patch/RFC 7396](https://www.rfc-editor.org/rfc/rfc7396): `merge-patch+json`

For details, see the [PATCH documentation](https://fusionauth.io/docs/apis.md#the-patch-http-method).

Using a media type of `application/json` merges the provided request parameters into the existing object. As a result, all parameters are optional with `PATCH`: only provide the values you want to change. To remove a value, provide a `null` value. Patching an `Array` appends all values in the new list to the old list.

#### Request Parameters

`formId`UUIDrequired

The Id of the Form to update.

#### Request Body

`form.data`Objectoptional

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

`form.name`Stringrequired

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` or `adminUser` steps will be rendered as `sections` because there are no multi-step forms within the admin 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.

```plaintext
{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:

```plaintext
[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:

```plaintext
[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.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

The possible values are:

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber` - Perform verification on **user.phoneNumber** before user creation.

*   `verifyEmail` and `verifyPhoneNumber` are only valid when **form.type** is `registration`.
*   When using the `verify*` step types, if the form includes a `user.password` field, that field must be AFTER the last `verify*` step.
*   If `verifyEmail` is used, **user.email** must be included on a step prior to the `verifyEmail` step.
*   If `verifyPhoneNumber` is used, **user.phoneNumber** must be included on a step prior to the `verifyPhoneNumber` step.

`form.type`StringoptionalDefaults 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 admin UI. Available since 1.20.0
*   `adminUser` - This form can be used to customize the add and edit User form in the FusionAuth admin 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*

```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"
        ],
        "type": "collectData"
      },
      {
        "fields": [],
        "type": "verifyEmail"
      },
      {
        "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](https://fusionauth.io/docs/apis/errors.md) 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](https://fusionauth.io/docs/apis/authentication.md). |
| 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](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was added to the FusionAuth database.

`form.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that the Form was last updated in the FusionAuth database.

`form.name`String

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.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber`\- Perform verification on **user.phoneNumber** before user creation.

`form.steps[x].type`StringoptionalDefaults to collectDataAvailable since 1.62.0

The type of step being created.

The possible values are:

*   `collectData` - Standard form step type that collects fields from the user.
*   `verifyEmail` - Perform verification on **user.email** before user creation.
*   `verifyPhoneNumber` - Perform verification on **user.phoneNumber** before user creation.

`form.type`String

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 admin UI. Available since 1.20.0
*   `adminUser` - This form can be used to customize the add and edit User form in the FusionAuth admin 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](https://fusionauth.io/docs/lifecycle/manage-users/account-management.md). Available since 1.26.0

*Example Response JSON*

```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

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Delete a Form by Id

DELETE/api/form/{formId}

OpenAPI Spec

#### Request Parameters

`formId`UUIDrequired

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](https://fusionauth.io/docs/apis/errors.md) 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](https://fusionauth.io/docs/apis/authentication.md). |
| 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. |