# How to add validation to the custom attribute

**URL:** <https://forum.keycloak.org/t/how-to-add-validation-to-the-custom-attribute/14617>\
**Category:** Getting advice\
**Created:** [March 28, 2022, 12:06pm UTC](https://forum.keycloak.org/t/how-to-add-validation-to-the-custom-attribute/14617 "2022-03-28T12:06:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://forum.keycloak.org/u/John1)\
**Post date:** [March 28, 2022, 12:06pm UTC](https://forum.keycloak.org/t/how-to-add-validation-to-the-custom-attribute/14617/1 "2022-03-28T12:06:08Z")

</div>

HI,  
I added some custom attributes in registration page, Now I would like to put some Validation on the attributes.  
Can someone tell which file to modify to add the validation for the same

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [March 28, 2022, 12:17pm UTC](https://forum.keycloak.org/t/how-to-add-validation-to-the-custom-attribute/14617/2 "2022-03-28T12:17:31Z")

</div>

The new User Profile SPI might be what you are looking for: [Server Administration Guide](https://www.keycloak.org/docs/latest/server_admin/index.html#user-profile)  
It’s still a preview feature, but it allows to add custom attributes and validate them (and also the default ones).

---

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://forum.keycloak.org/u/John1)\
**Post date:** [March 28, 2022, 12:26pm UTC](https://forum.keycloak.org/t/how-to-add-validation-to-the-custom-attribute/14617/3 "2022-03-28T12:26:02Z")

</div>

Thank you @dasniko  
I will look into User Profile SPI  
😇
