Themes APIs

1. Overview

This API has been available since 1.8.0

UI login themes can be configured to enable custom branding for your FusionAuth login workflow. Themes are configured per Tenant.

The following APIs are provided to manage Themes.

2. Create a Theme

This API is used to create a new Theme.

2.1. Request

Create a new Theme with a randomly generated Id

URI

POST /api/theme

Create a Theme with the provided unique Id

URI

POST /api/theme/{themeId}

Table 1. Request Parameters

themeId [UUID] Optional defaults to secure random UUID

The Id to use for the new Theme. If not specified a secure random UUID will be generated.

Table 2. Request Body

sourceThemeId [UUID] Optional

The optional ID of an existing Theme to make a copy of. If present, the defaultMessages, localizedMessages, templates, and stylesheet from the source Theme will be copied to the new Theme.

theme.defaultMessages [String] Required

A properties file formatted String containing at least all of the message keys defined in the FusionAuth shipped messages file. Required if not copying an existing Theme.

theme.localizedMessages [Map<Locale,String>] Optional

A Map of localized versions of the messages. The key is the Locale and the value is a properties file formatted String.

theme.name [String] Required

A unique name for the Theme.

theme.stylesheet [String] Optional

A CSS stylesheet used to style the templates.

theme.templates.emailComplete [String] Optional

A FreeMarker template that is rendered when the user requests the /email/complete page. This page is used after a user has verified their email address by clicking the URL in the email. After FusionAuth has updated their user object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.emailSend [String] Optional

A FreeMarker template that is rendered when the user requests the /email/send page. This page is used after a user has asked for the verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.emailVerify [String] Optional

A FreeMarker template that is rendered when the user requests the /email/verify page by clicking the URL from the verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

theme.templates.helpers [String] Optional

A FreeMarker template that contains all of the macros and templates used by the rest of the loginTheme FreeMarker templates (i.e. oauth2Authorize). This allows you to configure the general layout of your UI configuration and login theme without having to copy and paste HTML into each of the templates.

theme.templates.oauth2Authorize [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/authorize page. This is the main login page for FusionAuth and is used for all interactive OAuth and OpenId Connect workflows.

theme.templates.oauth2ChildRegistrationNotAllowed [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed page. This is where the child must provide their parent’s email address to ask their parent to create an account for them.

theme.templates.oauth2ChildRegistrationNotAllowedComplete [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed-complete page. This is where the browser is taken after the child provides their parent’s email address.

theme.templates.oauth2CompleteRegistration [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/complete-registration page. This page is used for users that have accounts but might be missing required fields.

theme.templates.oauth2Error [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/error page. This page is used if the user starts or is in the middle of the OAuth workflow and any type of error occurs. This could be caused by the user messing with the URL or internally some type of information wasn’t passed between the OAuth endpoints correctly. For example, if you are federating login to an external IdP and that IdP does not properly echo the state parameter, FusionAuth’s OAuth workflow will break and this page will be displayed.

theme.templates.oauth2Logout [String] Available Since 1.10.0 Optional

A FreeMarker template that is rendered when the user requests the /oauth2/logout page. This page is used if the user initiates a logout. This page causes the user to be logged out of all associated applications via a front-channel mechanism before being redirected.

theme.templates.oauth2Register [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/register page. This page is used for users that need to register (sign-up)

theme.templates.oauth2TwoFactor [String] Optional

A FreeMarker template that is rendered when the user requests the /oauth2/two-factor page. This page is used if the user has two-factor authentication enabled and they need to type in their code again. FusionAuth will properly handle the SMS or authenticator app processing on the back end. This page contains the form that the user will put their code into.

theme.templates.passwordChange [String] Optional

A FreeMarker template that is rendered when the user requests the /password/change page. This page is used if the user is required to change their password or if they have requested a password reset. This page contains the form that allows the user to provide a new password.

theme.templates.passwordComplete [String] Optional

A FreeMarker template that is rendered when the user requests the /password/complete page. This page is used after the user has successfully updated their password (or reset it). This page should instruct the user that their password was updated and that they need to login again.

theme.templates.passwordForgot [String] Optional

A FreeMarker template that is rendered when the user requests the /password/forgot page. This page is used when a user starts the forgot password workflow. This page renders the form where the user types in their email address.

theme.templates.passwordSent [String] Optional

A FreeMarker template that is rendered when the user requests the /password/sent page. This page is used when a user has submitted the forgot password form with their email. FusionAuth does not indicate back to the user if their email address was valid in order to prevent malicious activity that could reveal valid email addresses. Therefore, this page should indicate to the user that if their email was valid, they will receive an email shortly with a link to reset their password.

theme.templates.registrationComplete [String] Optional

A FreeMarker template that is rendered when the user requests the /registration/complete page. This page is used after a user has verified their email address for a specific application (i.e. a user registration) by clicking the URL in the email. After FusionAuth has updated their registration object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.registrationSend [String] Optional

A FreeMarker template that is rendered when the user requests the /registration/send page. This page is used after a user has asked for the application specific verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.registrationVerify [String] Optional

A FreeMarker template that is rendered when the user requests the /registration/verify page by clicking the URL from the application specific verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

Example Request JSON
{
  "theme": {
    "defaultMessages": "title=Login",
    "localizedMessages": {
      "fr": "title=Identifiant",
      "es": "title=Iniciar sesión"
    },
    "name": "Orange Theme",
    "templates": {
      "emailComplete": "[#ftl/]",
      "emailSend": "[#ftl/]",
      "emailVerify": "[#ftl/]",
      "helpers": "[#ftl/]",
      "oauth2Authorize": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowed": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowedComplete": "[#ftl/]",
      "oauth2CompleteRegistration": "[#ftl/]",
      "oauth2Error": "[#ftl/]",
      "oauth2Logout": "[#ftl/]",
      "oauth2Passwordless": "[#ftl/]",
      "oauth2Register": "[#ftl/]",
      "oauth2TwoFactor": "[#ftl/]",
      "passwordChange": "[#ftl/]",
      "passwordComplete": "[#ftl/]",
      "passwordForgot": "[#ftl/]",
      "passwordSent": "[#ftl/]",
      "registrationComplete": "[#ftl/]",
      "registrationSend": "[#ftl/]",
      "registrationVerify": "[#ftl/]"
    }
  }
}

3. Retrieve a Theme

This API is used to retrieve a single Theme by unique Id or all of the Themes.

3.1. Request

Retrieve all of the Themes

URI

GET /api/theme

Retrieve a Theme by Id

URI

GET /api/theme/{themeId}

Table 3. Request Parameters

themeId [UUID] Required

The unique Id of the Theme to retrieve.

3.2. Response

The response for this API contains either a single Theme or all of the Themes. When you call this API with an Id the response will contain a single Theme. When you call this API without an Id the response will contain all of the themes. Both response types are defined below along with an example JSON response.

Table 4. 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.

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.

503

The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.

Table 5. Response Body for a single Theme

theme.defaultMessages [Integer]

A properties file formatted String containing messages used within the templates.

theme.id [UUID]

The unique Id of the Theme.

theme.insertInstant [Integer]

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

theme.lastUpdateInstant [Integer]

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

theme.localizedMessages [Map<Locale,String>]

A Map of localized versions of the messages. The key is the Locale and the value is a properties file formatted String.

theme.name [String]

A unique name for the Theme.

theme.stylesheet [String]

A CSS stylesheet used to style the templates.

theme.templates.emailComplete [String]

A FreeMarker template that is rendered when the user requests the /email/complete page. This page is used after a user has verified their email address by clicking the URL in the email. After FusionAuth has updated their user object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.emailSend [String]

A FreeMarker template that is rendered when the user requests the /email/send page. This page is used after a user has asked for the verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.emailVerify [String]

A FreeMarker template that is rendered when the user requests the /email/verify page by clicking the URL from the verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

theme.templates.helpers [String]

A FreeMarker template that contains all of the macros and templates used by the rest of the loginTheme FreeMarker templates (i.e. oauth2Authorize). This allows you to configure the general layout of your UI configuration and login theme without having to copy and paste HTML into each of the templates.

theme.templates.oauth2Authorize [String]

A FreeMarker template that is rendered when the user requests the /oauth2/authorize page. This is the main login page for FusionAuth and is used for all interactive OAuth and OpenId Connect workflows.

theme.templates.oauth2ChildRegistrationNotAllowed [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed page. This is where the child must provide their parent’s email address to ask their parent to create an account for them.

theme.templates.oauth2ChildRegistrationNotAllowedComplete [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed-complete page. This is where the browser is taken after the child provides their parent’s email address.

theme.templates.oauth2CompleteRegistration [String]

A FreeMarker template that is rendered when the user requests the /oauth2/complete-registration page. This page is used for users that have accounts but might be missing required fields.

theme.templates.oauth2Error [String]

A FreeMarker template that is rendered when the user requests the /oauth2/error page. This page is used if the user starts or is in the middle of the OAuth workflow and any type of error occurs. This could be caused by the user messing with the URL or internally some type of information wasn’t passed between the OAuth endpoints correctly. For example, if you are federating login to an external IdP and that IdP does not properly echo the state parameter, FusionAuth’s OAuth workflow will break and this page will be displayed.

theme.templates.oauth2Logout [String] Available Since 1.10.0

A FreeMarker template that is rendered when the user requests the /oauth2/logout page. This page is used if the user initiates a logout. This page causes the user to be logged out of all associated applications via a front-channel mechanism before being redirected.

theme.templates.oauth2Register [String]

A FreeMarker template that is rendered when the user requests the /oauth2/register page. This page is used for users that need to register (sign-up)

theme.templates.oauth2TwoFactor [String]

A FreeMarker template that is rendered when the user requests the /oauth2/two-factor page. This page is used if the user has two-factor authentication enabled and they need to type in their code again. FusionAuth will properly handle the SMS or authenticator app processing on the back end. This page contains the form that the user will put their code into.

theme.templates.passwordChange [String]

A FreeMarker template that is rendered when the user requests the /password/change page. This page is used if the user is required to change their password or if they have requested a password reset. This page contains the form that allows the user to provide a new password.

theme.templates.passwordComplete [String]

A FreeMarker template that is rendered when the user requests the /password/complete page. This page is used after the user has successfully updated their password (or reset it). This page should instruct the user that their password was updated and that they need to login again.

theme.templates.passwordForgot [String]

A FreeMarker template that is rendered when the user requests the /password/forgot page. This page is used when a user starts the forgot password workflow. This page renders the form where the user types in their email address.

theme.templates.passwordSent [String]

A FreeMarker template that is rendered when the user requests the /password/sent page. This page is used when a user has submitted the forgot password form with their email. FusionAuth does not indicate back to the user if their email address was valid in order to prevent malicious activity that could reveal valid email addresses. Therefore, this page should indicate to the user that if their email was valid, they will receive an email shortly with a link to reset their password.

theme.templates.registrationComplete [String]

A FreeMarker template that is rendered when the user requests the /registration/complete page. This page is used after a user has verified their email address for a specific application (i.e. a user registration) by clicking the URL in the email. After FusionAuth has updated their registration object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.registrationSend [String]

A FreeMarker template that is rendered when the user requests the /registration/send page. This page is used after a user has asked for the application specific verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.registrationVerify [String]

A FreeMarker template that is rendered when the user requests the /registration/verify page by clicking the URL from the application specific verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

Example Response JSON
{
  "theme": {
    "defaultMessages": "title=Login",
    "id": "64773453-bb11-457b-a3d6-7475ec2259d0",
    "insertInstant": 1564006815352,
    "lastUpdateInstant": 1564084258150,
    "localizedMessages": {
      "fr": "title=Identifiant",
      "es": "title=Iniciar sesión"
    },
    "name": "Orange Theme",
    "stylesheet": "h1 {\r\n  color: orange;\r\n  text-align: center;\r\n}",
    "templates": {
      "emailComplete": "[#ftl/]",
      "emailSend": "[#ftl/]",
      "emailVerify": "[#ftl/]",
      "helpers": "[#ftl/]",
      "oauth2Authorize": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowed": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowedComplete": "[#ftl/]",
      "oauth2CompleteRegistration": "[#ftl/]",
      "oauth2Error": "[#ftl/]",
      "oauth2Logout": "[#ftl/]",
      "oauth2Passwordless": "[#ftl/]",
      "oauth2Register": "[#ftl/]",
      "oauth2TwoFactor": "[#ftl/]",
      "passwordChange": "[#ftl/]",
      "passwordComplete": "[#ftl/]",
      "passwordForgot": "[#ftl/]",
      "passwordSent": "[#ftl/]",
      "registrationComplete": "[#ftl/]",
      "registrationSend": "[#ftl/]",
      "registrationVerify": "[#ftl/]"
    }
  }
}
Table 6. Response Body for all Themes

themes [Array]

The list of Theme objects.

themes[x].defaultMessages [Integer]

A properties file formatted String containing messages used within the templates.

themes[x].id [UUID]

The unique Id of the Theme.

themes[x].insertInstant [Integer]

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

themes[x].lastUpdateInstant [Integer]

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

themes[x].localizedMessages [Map<Locale,String>]

A Map of localized versions of the messages. The key is the Locale and the value is a properties file formatted String.

themes[x].name [String]

A unique name for the Theme.

themes[x].stylesheet [String] Optional

A CSS stylesheet used to style the templates.

themes[x].templates.emailComplete [String]

A FreeMarker template that is rendered when the user requests the /email/complete page. This page is used after a user has verified their email address by clicking the URL in the email. After FusionAuth has updated their user object to indicate that their email was verified, the browser is redirected to this page.

themes[x].templates.emailSend [String]

A FreeMarker template that is rendered when the user requests the /email/send page. This page is used after a user has asked for the verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

themes[x].templates.emailVerify [String]

A FreeMarker template that is rendered when the user requests the /email/verify page by clicking the URL from the verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

themes[x].templates.helpers [String]

A FreeMarker template that contains all of the macros and templates used by the rest of the loginTheme FreeMarker templates (i.e. oauth2Authorize). This allows you to configure the general layout of your UI configuration and login theme without having to copy and paste HTML into each of the templates.

themes[x].templates.oauth2Authorize [String]

A FreeMarker template that is rendered when the user requests the /oauth2/authorize page. This is the main login page for FusionAuth and is used for all interactive OAuth and OpenId Connect workflows.

themes[x].templates.oauth2ChildRegistrationNotAllowed [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed page. This is where the child must provide their parent’s email address to ask their parent to create an account for them.

themes[x].templates.oauth2ChildRegistrationNotAllowedComplete [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed-complete page. This is where the browser is taken after the child provides their parent’s email address.

themes[x].templates.oauth2CompleteRegistration [String]

A FreeMarker template that is rendered when the user requests the /oauth2/complete-registration page. This page is used for users that have accounts but might be missing required fields.

themes[x].templates.oauth2Error [String]

A FreeMarker template that is rendered when the user requests the /oauth2/error page. This page is used if the user starts or is in the middle of the OAuth workflow and any type of error occurs. This could be caused by the user messing with the URL or internally some type of information wasn’t passed between the OAuth endpoints correctly. For example, if you are federating login to an external IdP and that IdP does not properly echo the state parameter, FusionAuth’s OAuth workflow will break and this page will be displayed.

themes[x].templates.oauth2Logout [String] Available Since 1.10.0

A FreeMarker template that is rendered when the user requests the /oauth2/logout page. This page is used if the user initiates a logout. This page causes the user to be logged out of all associated applications via a front-channel mechanism before being redirected.

themes[x].templates.oauth2Register [String]

A FreeMarker template that is rendered when the user requests the /oauth2/register page. This page is used for users that need to register (sign-up)

themes[x].templates.oauth2TwoFactor [String]

A FreeMarker template that is rendered when the user requests the /oauth2/two-factor page. This page is used if the user has two-factor authentication enabled and they need to type in their code again. FusionAuth will properly handle the SMS or authenticator app processing on the back end. This page contains the form that the user will put their code into.

themes[x].templates.passwordChange [String]

A FreeMarker template that is rendered when the user requests the /password/change page. This page is used if the user is required to change their password or if they have requested a password reset. This page contains the form that allows the user to provide a new password.

themes[x].templates.passwordComplete [String]

A FreeMarker template that is rendered when the user requests the /password/complete page. This page is used after the user has successfully updated their password (or reset it). This page should instruct the user that their password was updated and that they need to login again.

themes[x].templates.passwordForgot [String]

A FreeMarker template that is rendered when the user requests the /password/forgot page. This page is used when a user starts the forgot password workflow. This page renders the form where the user types in their email address.

themes[x].templates.passwordSent [String]

A FreeMarker template that is rendered when the user requests the /password/sent page. This page is used when a user has submitted the forgot password form with their email. FusionAuth does not indicate back to the user if their email address was valid in order to prevent malicious activity that could reveal valid email addresses. Therefore, this page should indicate to the user that if their email was valid, they will receive an email shortly with a link to reset their password.

themes[x].templates.registrationComplete [String]

A FreeMarker template that is rendered when the user requests the /registration/complete page. This page is used after a user has verified their email address for a specific application (i.e. a user registration) by clicking the URL in the email. After FusionAuth has updated their registration object to indicate that their email was verified, the browser is redirected to this page.

themes[x].templates.registrationSend [String]

A FreeMarker template that is rendered when the user requests the /registration/send page. This page is used after a user has asked for the application specific verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

themes[x].templates.registrationVerify [String]

A FreeMarker template that is rendered when the user requests the /registration/verify page by clicking the URL from the application specific verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

Example Response JSON
{
  "themes": [
    {
      "defaultMessages": "title=Login",
      "id": "64773453-bb11-457b-a3d6-7475ec2259d0",
      "insertInstant": 1564006815352,
      "lastUpdateInstant": 1564084258150,
      "localizedMessages": {
        "fr": "title=Identifiant",
        "es": "title=Iniciar sesión"
      },
      "name": "Orange Theme",
      "stylesheet": "h1 {\r\n  color: orange;\r\n  text-align: center;\r\n}",
      "templates": {
        "emailComplete": "[#ftl/]",
        "emailSend": "[#ftl/]",
        "emailVerify": "[#ftl/]",
        "helpers": "[#ftl/]",
        "oauth2Authorize": "[#ftl/]",
        "oauth2ChildRegistrationNotAllowed": "[#ftl/]",
        "oauth2ChildRegistrationNotAllowedComplete": "[#ftl/]",
        "oauth2CompleteRegistration": "[#ftl/]",
        "oauth2Error": "[#ftl/]",
        "oauth2Logout": "[#ftl/]",
        "oauth2Passwordless": "[#ftl/]",
        "oauth2Register": "[#ftl/]",
        "oauth2TwoFactor": "[#ftl/]",
        "passwordChange": "[#ftl/]",
        "passwordComplete": "[#ftl/]",
        "passwordForgot": "[#ftl/]",
        "passwordSent": "[#ftl/]",
        "registrationComplete": "[#ftl/]",
        "registrationSend": "[#ftl/]",
        "registrationVerify": "[#ftl/]"
      }
    },
    {
      "id": "75a068fd-e94b-451a-9aeb-3ddb9a3b5987",
      "insertInstant": 1563999505859,
      "lastUpdateInstant": 1564005677559,
      "name": "Default Theme"
    }
  ]
}

4. Update a Theme

This API is used to update an existing Theme. You must specify the Id of the Theme you are updating on the URI. You must specify all of the properties of the Theme when calling this API. This API does not merge the existing Theme and your new data. It replaces the existing Theme with your new data.

4.1. Request

Update the Theme with the given Id

URI

PUT /api/theme/{themeId}

Table 7. Request Parameters

themeId [UUID] Required

The unique Id of the Theme to update.

Table 8. Request Body

theme.defaultMessages [String] Required

A properties file formatted String containing at least all of the message keys defined in the FusionAuth shipped messages file. Required if not copying an existing Theme.

theme.localizedMessages [Map<Locale,String>] Optional

A Map of localized versions of the messages. The key is the Locale and the value is a properties file formatted String.

theme.name [String] Required

A unique name for the Theme.

theme.stylesheet [String] Optional

A CSS stylesheet used to style the templates.

theme.templates.emailComplete [String] Required

A FreeMarker template that is rendered when the user requests the /email/complete page. This page is used after a user has verified their email address by clicking the URL in the email. After FusionAuth has updated their user object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.emailSend [String] Required

A FreeMarker template that is rendered when the user requests the /email/send page. This page is used after a user has asked for the verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.emailVerify [String] Required

A FreeMarker template that is rendered when the user requests the /email/verify page by clicking the URL from the verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

theme.templates.helpers [String] Required

A FreeMarker template that contains all of the macros and templates used by the rest of the loginTheme FreeMarker templates (i.e. oauth2Authorize). This allows you to configure the general layout of your UI configuration and login theme without having to copy and paste HTML into each of the templates.

theme.templates.oauth2Authorize [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/authorize page. This is the main login page for FusionAuth and is used for all interactive OAuth and OpenId Connect workflows.

theme.templates.oauth2ChildRegistrationNotAllowed [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed page. This is where the child must provide their parent’s email address to ask their parent to create an account for them.

theme.templates.oauth2ChildRegistrationNotAllowedComplete [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed-complete page. This is where the browser is taken after the child provides their parent’s email address.

theme.templates.oauth2CompleteRegistration [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/complete-registration page. This page is used for users that have accounts but might be missing required fields.

theme.templates.oauth2Error [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/error page. This page is used if the user starts or is in the middle of the OAuth workflow and any type of error occurs. This could be caused by the user messing with the URL or internally some type of information wasn’t passed between the OAuth endpoints correctly. For example, if you are federating login to an external IdP and that IdP does not properly echo the state parameter, FusionAuth’s OAuth workflow will break and this page will be displayed.

theme.templates.oauth2Logout [String] Required Available Since 1.10.0

A FreeMarker template that is rendered when the user requests the /oauth2/logout page. This page is used if the user initiates a logout. This page causes the user to be logged out of all associated applications via a front-channel mechanism before being redirected.

theme.templates.oauth2Register [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/register page. This page is used for users that need to register (sign-up)

theme.templates.oauth2TwoFactor [String] Required

A FreeMarker template that is rendered when the user requests the /oauth2/two-factor page. This page is used if the user has two-factor authentication enabled and they need to type in their code again. FusionAuth will properly handle the SMS or authenticator app processing on the back end. This page contains the form that the user will put their code into.

theme.templates.passwordChange [String] Required

A FreeMarker template that is rendered when the user requests the /password/change page. This page is used if the user is required to change their password or if they have requested a password reset. This page contains the form that allows the user to provide a new password.

theme.templates.passwordComplete [String] Required

A FreeMarker template that is rendered when the user requests the /password/complete page. This page is used after the user has successfully updated their password (or reset it). This page should instruct the user that their password was updated and that they need to login again.

theme.templates.passwordForgot [String] Required

A FreeMarker template that is rendered when the user requests the /password/forgot page. This page is used when a user starts the forgot password workflow. This page renders the form where the user types in their email address.

theme.templates.passwordSent [String] Required

A FreeMarker template that is rendered when the user requests the /password/sent page. This page is used when a user has submitted the forgot password form with their email. FusionAuth does not indicate back to the user if their email address was valid in order to prevent malicious activity that could reveal valid email addresses. Therefore, this page should indicate to the user that if their email was valid, they will receive an email shortly with a link to reset their password.

theme.templates.registrationComplete [String] Required

A FreeMarker template that is rendered when the user requests the /registration/complete page. This page is used after a user has verified their email address for a specific application (i.e. a user registration) by clicking the URL in the email. After FusionAuth has updated their registration object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.registrationSend [String] Required

A FreeMarker template that is rendered when the user requests the /registration/send page. This page is used after a user has asked for the application specific verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.registrationVerify [String] Required

A FreeMarker template that is rendered when the user requests the /registration/verify page by clicking the URL from the application specific verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

Example Request JSON
{
  "theme": {
    "defaultMessages": "title=Login",
    "localizedMessages": {
      "fr": "title=Identifiant",
      "es": "title=Iniciar sesión"
    },
    "name": "Orange Theme",
    "templates": {
      "emailComplete": "[#ftl/]",
      "emailSend": "[#ftl/]",
      "emailVerify": "[#ftl/]",
      "helpers": "[#ftl/]",
      "oauth2Authorize": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowed": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowedComplete": "[#ftl/]",
      "oauth2CompleteRegistration": "[#ftl/]",
      "oauth2Error": "[#ftl/]",
      "oauth2Logout": "[#ftl/]",
      "oauth2Passwordless": "[#ftl/]",
      "oauth2Register": "[#ftl/]",
      "oauth2TwoFactor": "[#ftl/]",
      "passwordChange": "[#ftl/]",
      "passwordComplete": "[#ftl/]",
      "passwordForgot": "[#ftl/]",
      "passwordSent": "[#ftl/]",
      "registrationComplete": "[#ftl/]",
      "registrationSend": "[#ftl/]",
      "registrationVerify": "[#ftl/]"
    }
  }
}

4.2. Response

The response for this API contains the Theme that was updated.

Table 9. 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.

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 updated 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.

503

The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.

Table 10. Response Body for a single Theme

theme.defaultMessages [Integer]

A properties file formatted String containing messages used within the templates.

theme.id [UUID]

The unique Id of the Theme.

theme.insertInstant [Integer]

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

theme.lastUpdateInstant [Integer]

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

theme.localizedMessages [Map<Locale,String>]

A Map of localized versions of the messages. The key is the Locale and the value is a properties file formatted String.

theme.name [String]

A unique name for the Theme.

theme.stylesheet [String]

A CSS stylesheet used to style the templates.

theme.templates.emailComplete [String]

A FreeMarker template that is rendered when the user requests the /email/complete page. This page is used after a user has verified their email address by clicking the URL in the email. After FusionAuth has updated their user object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.emailSend [String]

A FreeMarker template that is rendered when the user requests the /email/send page. This page is used after a user has asked for the verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.emailVerify [String]

A FreeMarker template that is rendered when the user requests the /email/verify page by clicking the URL from the verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

theme.templates.helpers [String]

A FreeMarker template that contains all of the macros and templates used by the rest of the loginTheme FreeMarker templates (i.e. oauth2Authorize). This allows you to configure the general layout of your UI configuration and login theme without having to copy and paste HTML into each of the templates.

theme.templates.oauth2Authorize [String]

A FreeMarker template that is rendered when the user requests the /oauth2/authorize page. This is the main login page for FusionAuth and is used for all interactive OAuth and OpenId Connect workflows.

theme.templates.oauth2ChildRegistrationNotAllowed [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed page. This is where the child must provide their parent’s email address to ask their parent to create an account for them.

theme.templates.oauth2ChildRegistrationNotAllowedComplete [String]

A FreeMarker template that is rendered when the user requests the /oauth2/child-registration-not-allowed-complete page. This is where the browser is taken after the child provides their parent’s email address.

theme.templates.oauth2CompleteRegistration [String]

A FreeMarker template that is rendered when the user requests the /oauth2/complete-registration page. This page is used for users that have accounts but might be missing required fields.

theme.templates.oauth2Error [String]

A FreeMarker template that is rendered when the user requests the /oauth2/error page. This page is used if the user starts or is in the middle of the OAuth workflow and any type of error occurs. This could be caused by the user messing with the URL or internally some type of information wasn’t passed between the OAuth endpoints correctly. For example, if you are federating login to an external IdP and that IdP does not properly echo the state parameter, FusionAuth’s OAuth workflow will break and this page will be displayed.

theme.templates.oauth2Logout [String] Available Since 1.10.0

A FreeMarker template that is rendered when the user requests the /oauth2/logout page. This page is used if the user initiates a logout. This page causes the user to be logged out of all associated applications via a front-channel mechanism before being redirected.

theme.templates.oauth2Register [String]

A FreeMarker template that is rendered when the user requests the /oauth2/register page. This page is used for users that need to register (sign-up)

theme.templates.oauth2TwoFactor [String]

A FreeMarker template that is rendered when the user requests the /oauth2/two-factor page. This page is used if the user has two-factor authentication enabled and they need to type in their code again. FusionAuth will properly handle the SMS or authenticator app processing on the back end. This page contains the form that the user will put their code into.

theme.templates.passwordChange [String]

A FreeMarker template that is rendered when the user requests the /password/change page. This page is used if the user is required to change their password or if they have requested a password reset. This page contains the form that allows the user to provide a new password.

theme.templates.passwordComplete [String]

A FreeMarker template that is rendered when the user requests the /password/complete page. This page is used after the user has successfully updated their password (or reset it). This page should instruct the user that their password was updated and that they need to login again.

theme.templates.passwordForgot [String]

A FreeMarker template that is rendered when the user requests the /password/forgot page. This page is used when a user starts the forgot password workflow. This page renders the form where the user types in their email address.

theme.templates.passwordSent [String]

A FreeMarker template that is rendered when the user requests the /password/sent page. This page is used when a user has submitted the forgot password form with their email. FusionAuth does not indicate back to the user if their email address was valid in order to prevent malicious activity that could reveal valid email addresses. Therefore, this page should indicate to the user that if their email was valid, they will receive an email shortly with a link to reset their password.

theme.templates.registrationComplete [String]

A FreeMarker template that is rendered when the user requests the /registration/complete page. This page is used after a user has verified their email address for a specific application (i.e. a user registration) by clicking the URL in the email. After FusionAuth has updated their registration object to indicate that their email was verified, the browser is redirected to this page.

theme.templates.registrationSend [String]

A FreeMarker template that is rendered when the user requests the /registration/send page. This page is used after a user has asked for the application specific verification email to be resent. This can happen if the URL in the email expired and the user clicked it. In this case, the user can provide their email address again and FusionAuth will resend the email. After the user submits their email and FusionAuth re-sends a verification email to them, the browser is redirected to this page.

theme.templates.registrationVerify [String]

A FreeMarker template that is rendered when the user requests the /registration/verify page by clicking the URL from the application specific verification email and the verificationId has expired. FusionAuth expires verificationId after a period of time (which is configurable). If the user has a URL from the verification email that has expired, this page will be rendered and the error will be displayed to the user.

Example Response JSON
{
  "theme": {
    "defaultMessages": "title=Login",
    "id": "64773453-bb11-457b-a3d6-7475ec2259d0",
    "insertInstant": 1564006815352,
    "lastUpdateInstant": 1564084258150,
    "localizedMessages": {
      "fr": "title=Identifiant",
      "es": "title=Iniciar sesión"
    },
    "name": "Orange Theme",
    "stylesheet": "h1 {\r\n  color: orange;\r\n  text-align: center;\r\n}",
    "templates": {
      "emailComplete": "[#ftl/]",
      "emailSend": "[#ftl/]",
      "emailVerify": "[#ftl/]",
      "helpers": "[#ftl/]",
      "oauth2Authorize": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowed": "[#ftl/]",
      "oauth2ChildRegistrationNotAllowedComplete": "[#ftl/]",
      "oauth2CompleteRegistration": "[#ftl/]",
      "oauth2Error": "[#ftl/]",
      "oauth2Logout": "[#ftl/]",
      "oauth2Passwordless": "[#ftl/]",
      "oauth2Register": "[#ftl/]",
      "oauth2TwoFactor": "[#ftl/]",
      "passwordChange": "[#ftl/]",
      "passwordComplete": "[#ftl/]",
      "passwordForgot": "[#ftl/]",
      "passwordSent": "[#ftl/]",
      "registrationComplete": "[#ftl/]",
      "registrationSend": "[#ftl/]",
      "registrationVerify": "[#ftl/]"
    }
  }
}

5. Delete a Theme

This API is used to permanently delete a Theme.

5.1. Request

Delete a Theme by Id

URI

DELETE /api/theme/{themeId}

Table 11. Request Parameters

themeId [UUID] Required

The unique Id of the Theme to delete.

5.2. Response

This API does not return a JSON response body.

Table 12. Response Codes
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.

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.

503

The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body.