# Path error when trying to create (assign) permissions to a user via the management api

**URL:** <https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206>\
**Category:** Get Help\
**Tags:** api, management-api, auth0\
**Created:** [May 4, 2021, 3:20pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206 "2021-05-04T15:20:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spopida](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/spopida/32/12951_2.png) [@spopida](https://community.auth0.com/u/spopida)\
**Post date:** [May 4, 2021, 3:20pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/1 "2021-05-04T15:20:07Z")

</div>

Hi - I’m getting the following 400 error when attempting to assign permissions to a recently created user:

{  
“statusCode”: 400,  
“error”: “Bad Request”,  
“message”: “Path validation error: ‘Object didn’t pass validation for format user-id-with-max-length: 60911603a5c3a9450ae5aea6’ on property id (ID of the user to assign permissions to).”,  
“errorCode”: “invalid\_uri”  
}

The uri I am using is:

https://\<my-tenant-domain/api/v2/users/60911603a5c3a9450ae5aea6/permissions

And the body of the POST is: {“permissions”:[“read:company\_profile”]}

What’s going wrong here? I can’t see any documented limit on the user\_id length. It’s easily confused with the username attribute, but that can’t be the issue - I am not using username, and the error is complaining about the URI path which contains the user\_id, not the username

Thanks in advance

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [May 4, 2021, 4:08pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/3 "2021-05-04T16:08:14Z")

</div>

Hi @spopida,

Welcome to the Community!

The user ID will follow the following pattern `<connection name>|<user id in connection>`

For example, a Google social connection user would look like this: `google-oauth2|115088824167938831773`

The pipe (`|`) will need to be URL encoded: `%7C`

The endpoint would be: `https://YOUR_DOMAIN/api/v2/users/google-oauth2%7C115088824167938831773/permissions`

Also, the body of the request should contain an array of objects like this:

```auto
{
  "permissions": [{
    "resource_server_identifier": "https://you-api-identifier/",
    "permission_name": "read:company_profile"
  }]
}

```

> **[Auth0 Management API v2](https://auth0.com/docs/api/management/v2?_ga=2.246162692.1847387816.1618225160-1595415333.1607347674#!/Users/post_permissions)**

---

<div class="post-metadata">

**Author:** ![spopida](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/spopida/32/12951_2.png) [@spopida](https://community.auth0.com/u/spopida)\
**Post date:** [May 4, 2021, 6:50pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/4 "2021-05-04T18:50:46Z")

</div>

Hi Stephanie - thanks so much for the prompt reply; really helpful. I got most of the way there after posting the question, but I don’t know how long it would have taken me to figure out the URL encoding. Out of interest, is this documented anywhere? I’m sure it must be, but I couldn’t see it in the API docs for this endpoint (e.g. it just says there needs to be an array of “object”). Anyway, thanks again.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [May 4, 2021, 7:09pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/5 "2021-05-04T19:09:43Z")

</div>

You’re welcome! Glad to hear it is helpful info.

There are a couple of places in the docs where the user ID format is documented ([example](https://auth0.com/docs/users/identify-users)), but I’m not sure if there is documentation for URL-encoding the user ID when calling the Management API.

Regarding the array of objects, I found the schema by calling the [GET](https://auth0.com/docs/api/management/v2?_ga=2.246162692.1847387816.1618225160-1595415333.1607347674#!/Users/get_permissions)[/api/v2/users/{id}/permissions](https://auth0.com/docs/api/management/v2?_ga=2.246162692.1847387816.1618225160-1595415333.1607347674#!/Users/get_permissions) endpoint to see what the array of objects should look like. I agree that it could be helpful to include the schema of the objects in the docs directly. I will pass on that feedback. Thank you!

---

<div class="post-metadata">

**Author:** ![spopida](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/spopida/32/12951_2.png) [@spopida](https://community.auth0.com/u/spopida)\
**Post date:** [May 4, 2021, 9:46pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/6 "2021-05-04T21:46:12Z")

</div>

OK - well, many thanks again for the info - great support.

---

<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:** [May 19, 2021, 9:47pm UTC](https://community.auth0.com/t/path-error-when-trying-to-create-assign-permissions-to-a-user-via-the-management-api/62206/7 "2021-05-19T21:47:06Z")

</div>

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