> 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/no-data/auth-scopes-user-id-matching/same-account-multiple-reference-ids-duplicates.md).

# Why does user\_id not match between UI and webhooks?

This is expected behaviour driven by `reference_id`.

Reauth events are emitted only when the same `reference_id` is reused for the same provider account; reconnecting with a different `reference_id` creates a separate user record. On the current API, when the same account reconnects the old user record is deleted and replaced, which can explain UI/webhook mismatches. On the newer API version, same account + same `reference_id` still triggers reauth, but same account + a different `reference_id` keeps both records.

The dashboard UI shows the most recent `user_id`/`reference_id` for an account, while webhooks continue for every active connection, each keeping its original ids. **Always use the `user_id` and `reference_id` from the** [**webhook payload**](https://docs.tryterra.co/health-and-fitness-api/user-authentication/handling-authentication-events) **for data processing.**

Blocking the same account under different `reference_id`s is not natively supported. To detect that an account was connected before:

{% stepper %}
{% step %}
Query the `/athlete` endpoint.
{% endstep %}

{% step %}
Compare the `provider_user_id` (the account's unique id on the provider side).
{% endstep %}

{% step %}
Dedupe or disconnect on your side.
{% endstep %}
{% endstepper %}

Note that for Apple the `provider_user_id` is OS-managed and can change on app reinstalls.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/no-data/auth-scopes-user-id-matching/same-account-multiple-reference-ids-duplicates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
