AUTH_SANDBOX_MISMATCH

A test key was used with live data, or a live key was used with sandbox data.

HTTP status: 403. Retrying the same request returns the same error.

What to do

Check which key your environment loads. Test keys start with pyas_sk_test_. Live keys start with pyas_sk_ and do not include test_. To test connecting accounts in the sandbox, use PyasConnect with a connect session created with your test key.

Hint returned with the error: Use a test key for sandbox requests and a live key for real connections.

Why it happens

  • API keys swapped between environments
  • A request that only works with real accounts was sent with a test key: an account import, or connecting without PyasConnect (GET /v2/connect/oauth)

Endpoints that return it