Auth0 Management API - Patch request successful but not actually updating user

I’ve been noticing this occurring intermittently for two weeks now. When I make a PATCH request to /api/v2/users/{user-id} to update a value in the app_metadata, I get a successful response along with the updated user info in the response body. This response body does reflect the changes I’m making in the patch. However, when I do a GET to the same user that was patched to get the app_metadata, the metadata returned is the old, non-updated data. Also, the data is not updated on the user’s page in the management console either. Not sure why this is happening.

A couple of things to note - I’m not immediately making the GET after the PATCH. In my application there is about 2-3 seconds of delay and in testing this manually, a few minutes. I’m not doing any caching on my end. Confirmed the access token is updated and not expired. Scopes are good. I notice this behavior occurs for about 2 hours, and then seems to resolve itself. Any help would be greatly appreciated.

Hi @ia-auth0-user,

Welcome to the Auth0 Community and thank you for your post.

As mentioned in our public docs, the GET /api/v2/users endpoint is eventually consistent . This means that search results may not reflect a recently completed write operation. However, if the request is repeated after some period of time, the response will eventually return up-to-date data.

If the expiration time of the access_token is set to 2 hours, a new access token is returned, so that is why you are experiencing this behavior for only this period of time.

As an alternative for immediate consistency you can use this endpoints :

I hope this helps your use case.
Best regards,
Remus