> 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/api-endpoints-errors-and-migrations/environment-mismatch-invalid-user-id.md).

# Why does /activity return invalid user id after auth?

An `invalid user id` error on a user that looks authenticated usually means **the request credentials belong to a different** [**environment**](https://docs.tryterra.co/health-and-fitness-api/integration-setup/understanding-terra-environments) **than the user.**

A user is only visible to credentials from the same environment they were created in. So make sure both your `dev-id` and `x-api-key` headers come from the same environment (e.g. production) as the user.

With those aligned, `/activity` and `/plannedWorkout` will resolve the user correctly.
