# How to assign a role via API instead of rule (e. g. make user admin)?

**URL:** <https://community.auth0.com/t/how-to-assign-a-role-via-api-instead-of-rule-e-g-make-user-admin/18125>\
**Category:** Get Help\
**Created:** [November 20, 2018, 11:23am UTC](https://community.auth0.com/t/how-to-assign-a-role-via-api-instead-of-rule-e-g-make-user-admin/18125 "2018-11-20T11:23:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andreas1/32/9740_2.png) [@andreas1](https://community.auth0.com/u/andreas1)\
**Post date:** [November 20, 2018, 11:23am UTC](https://community.auth0.com/t/how-to-assign-a-role-via-api-instead-of-rule-e-g-make-user-admin/18125/1 "2018-11-20T11:23:12Z")

</div>

Everything I’ve found for rules and permissions so far is always done via rules, which run after successful auth. But what if I for example want to:

- create a new user
- assign a “editor” role to the user upon creation?

A rule wouldn’t be the right thing to do here. I’m sure there’s a way to run something like a rule on command? So to feed in the type of role I want to set for the user?

---

<div class="post-metadata">

**Author:** ![markd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/markd/32/38919_2.png) [@markd](https://community.auth0.com/u/markd)\
**Post date:** [November 20, 2018, 1:06pm UTC](https://community.auth0.com/t/how-to-assign-a-role-via-api-instead-of-rule-e-g-make-user-admin/18125/2 "2018-11-20T13:06:36Z")

</div>

You could use a [hook](https://auth0.com/docs/hooks).

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [August 28, 2019, 11:56am UTC](https://community.auth0.com/t/how-to-assign-a-role-via-api-instead-of-rule-e-g-make-user-admin/18125/3 "2019-08-28T11:56:31Z")

</div>


