# Predefined attributes for a new role

**URL:** <https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368>\
**Category:** Extending the server\
**Created:** [July 8, 2022, 9:05am UTC](https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368 "2022-07-08T09:05:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mzubzzz](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/mzubzzz/32/6137_2.png) [@mzubzzz](https://forum.keycloak.org/u/mzubzzz)\
**Post date:** [July 8, 2022, 9:05am UTC](https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368/1 "2022-07-08T09:05:32Z")

</div>

Is there some way to set up predefined attributes for a role?  
When I create a new role i need the role already would have some predefined attributes

---

<div class="post-metadata">

**Author:** ![weltonrodrigo](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/weltonrodrigo/32/3104_2.png) [@weltonrodrigo](https://forum.keycloak.org/u/weltonrodrigo)\
**Post date:** [July 8, 2022, 5:30pm UTC](https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368/2 "2022-07-08T17:30:36Z")

</div>

I don’t believe roles have attributes in Keycloak.

You can set hardcoded attributes when importing syncing users from federated bases using mappers.

---

<div class="post-metadata">

**Author:** ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)\
**Post date:** [July 9, 2022, 5:43pm UTC](https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368/3 "2022-07-09T17:43:31Z")

</div>

> [@weltonrodrigo](#):
>
> I don’t believe roles have attributes in Keycloak.

That is incorrect. Both realm and client roles have attributes.

@mzubzzz What do you mean by “predefined attributes for a role”? Role attributes can be set on role creation. Take a look at the admin API [https://www.keycloak.org/docs-api/18.0/rest-api/index.html#\_createrole](https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_createrole) for role creation.

---

<div class="post-metadata">

**Author:** ![weltonrodrigo](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/weltonrodrigo/32/3104_2.png) [@weltonrodrigo](https://forum.keycloak.org/u/weltonrodrigo)\
**Post date:** [July 10, 2022, 7:02pm UTC](https://forum.keycloak.org/t/predefined-attributes-for-a-new-role/16368/4 "2022-07-10T19:02:38Z")

</div>

> [@xgp](#):
>
> That is incorrect. Both realm and client roles have attributes.

You are correct. Apparently, only composite rules have no attributes.
