> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/data-api-sdk/authentication-users-and-connection-state/multiple-terra-users-per-reference-id.md).

# Why are there multiple Terra users for one reference\_id?

A single provider account maps to **exactly one Terra user**. Multiple Terra users for the same `reference_id` and provider occur when **two different provider accounts** are authenticated under that `reference_id`. Each distinct provider account gets its own Terra user by design.

If two Terra user IDs appear to receive identical data from the same device, the likely cause is a logging error on your side, or both users authenticating the same provider account.

* **To clean up**: deauthenticate the stale user via `/auth/deauthenticateUser`.
* **To prevent it**: check existing active connections via List Users before initiating auth.

For **Apple Health** specifically, `provider_user_id` identifies the same device and stays stable as long as the same app (same vendor and package) remains installed. It resets on uninstall/reinstall, which is why reinstalling between test connections yields different IDs.
