# Auth0 management API APP metadata

**URL:** <https://community.auth0.com/t/auth0-management-api-app-metadata/116372>\
**Category:** Get Help\
**Tags:** management-api, roles\
**Created:** [September 15, 2023, 6:01pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372 "2023-09-15T18:01:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![trey.mccloud33](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/trey.mccloud33/32/50433_2.png) [@trey.mccloud33](https://community.auth0.com/u/trey.mccloud33)\
**Post date:** [September 15, 2023, 6:01pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372/1 "2023-09-15T18:01:11Z")

</div>

Hello Everyone

I am building a subscription service using stripe and want to update user access from stripes webhook. I set up auth0 actions to create a stripe id and store it in the app metadata of a user. I am now trying to get stripe to talk to auth0 so I can update user roles in a python backend.

Stripes webhook trigger lets you know whenever a subscrition payment has been canceled.

I was going to use that trigger to pull the email from the stripe webhook and update the user role to restrict access for that user. However after reading auth0’s documentation, I found that it is a best practice to not use the email to update a customer.

Is it possible for auth0 management api to identify a user by their app metadata?

---

<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:** [September 15, 2023, 8:04pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372/3 "2023-09-15T20:04:33Z")

</div>

Hey @trey.mccloud33 welcome to the community!

> [@trey.mccloud33](#):
>
> Is it possible for auth0 management api to identify a user by their app metadata?

This is indeed possible! You’ll want to check out the documentation on [User Search Query Syntax](https://auth0.com/docs/manage-users/user-search/user-search-query-syntax) but a query will look something like this:

`GET https://{your_domain}/api/v2/users?q=app_metadata.test_metadata:"12345"`

Hope this helps!

---

<div class="post-metadata">

**Author:** ![trey.mccloud33](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/trey.mccloud33/32/50433_2.png) [@trey.mccloud33](https://community.auth0.com/u/trey.mccloud33)\
**Post date:** [September 18, 2023, 7:26pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372/4 "2023-09-18T19:26:45Z")

</div>

@ty.frith thank you for the response. I was going to set up a database in aws to store both the auth0 userid and stripe id to update the role without storing the pw info. My thinking is that I need a centralized database to keep track of each users stripe id and auth0 id and update it whenever a customer payment gets updated (webhook trigger).

After reading more documentation it looks like I may not need the database to keep trackand could use the auth0 database instead.

could i append the remove role from a user api to "https://{your\_domain}/api/v2/users?q=app\_metadata.test\_metadata:“12345” ?

for example

import requests  
import json  
url = “[https://login.auth0.com/api/v2/users/:id/roles](https://login.auth0.com/api/v2/users/:id/roles)”

payload = json.dumps({  
“roles”: [  
“string”  
]  
})

headers = {  
‘Content-Type’: ‘application/json’  
}

response = requests.request(“DELETE”, url, headers=headers, data=payload)

print(response.text)

---

<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:** [September 26, 2023, 10:48pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372/5 "2023-09-26T22:48:20Z")

</div>

Hey @trey.mccloud33 sorry for the delayed response - You unfortunately cannot use the query url in place of `/api/v2/users/:id/roles`.

---

<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:** [October 10, 2023, 10:48pm UTC](https://community.auth0.com/t/auth0-management-api-app-metadata/116372/6 "2023-10-10T22:48:40Z")

</div>

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