# Help with api to api set role to user

**URL:** <https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764>\
**Category:** Get Help\
**Tags:** management-api, roles\
**Created:** [October 18, 2023, 2:03am UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764 "2023-10-18T02:03:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugo127sanchez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hugo127sanchez/32/47506_2.png) [@hugo127sanchez](https://community.auth0.com/u/hugo127sanchez)\
**Post date:** [October 18, 2023, 2:03am UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764/1 "2023-10-18T02:03:25Z")

</div>

good morning! sorry for the inconvenience. with a question that may be a little silly. I have a problem assigning a role to my user. I am using the test from [Auth0 Management API v2](https://auth0.com/docs/api/management/v2/users/post-user-roles)  
and in my path it asks for my user ID. When I put it I get this error

```auto
"statusCode": 400,
   "error": "Bad Request",
   "message": "Path validation error: 'Object didn't pass validation for format user-id-with-max-length: 114552882084658623149' on property id (ID of the user to associate roles with).",
   "errorCode": "invalid_uri"

```

I am passing the user\_id. What could be wrong? again sorry for the inconvenience

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [October 18, 2023, 8:09pm UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764/3 "2023-10-18T20:09:46Z")

</div>

Hello @hugo127sanchez !

> [@hugo127sanchez](#):
>
> I am passing the user\_id. What could be wrong? again sorry for the inconvenience

No worries, happy to help 🙂 Hmmm, judging by the error it seems to be an issue with the user id param passing validation - Does the `id` you’re passing look something like this: `auth0|622bc004a1712a00699ff0f0` ?

---

<div class="post-metadata">

**Author:** ![hugo127sanchez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/hugo127sanchez/32/47506_2.png) [@hugo127sanchez](https://community.auth0.com/u/hugo127sanchez)\
**Post date:** [October 18, 2023, 10:34pm UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764/4 "2023-10-18T22:34:23Z")

</div>

hello good! I had not tried putting auth0| I was only passing the id part. I’ve tried it and it worked wonderfully. Thank you very much for the help!

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [October 18, 2023, 11:34pm UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764/5 "2023-10-18T23:34:45Z")

</div>

No problem, happy to help - Thanks for confirming!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 1, 2023, 11:35pm UTC](https://community.auth0.com/t/help-with-api-to-api-set-role-to-user/118764/6 "2023-11-01T23:35:03Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
