# Authentication and environments Building with an AI agent? Start at https://docs.payme.io/agents.md ## Related - [Get an access token](/products-and-customers/authentication/post-auth-token) - [Refresh an access token](/products-and-customers/authentication/post-auth-refresh) - [Errors](/products-and-customers/getting-started/errors) - [Authentication and environments](/payments/getting-started/authentication) Every product and customer call goes to one of two hosts and carries an access token for the seller. ## Hosts | Environment | Base URL | |---|---| | Sandbox (testing) | `https://payme-store-staging.payme.io/api/` | | Production | `https://payme-store.payme.io/api/` | These hosts are separate from the Payments API hosts (`sandbox.payme.io`, `live.payme.io`). Use sandbox credentials (the seller's sandbox MPL and your sandbox `payme_client_key`) with the sandbox host, and production credentials with the production host. ## Authentication 1. Call [`POST /auth-tokens`](/products-and-customers/authentication/post-auth-token) with `{"mpl": "", "key": ""}`. The seller must belong to the partner whose key you send. The call returns HTTP `201` with `auth_token` (a JWT) and `refresh_token`. 2. Send `Authorization: Bearer ` on every product and customer call. A missing, invalid or expired token returns HTTP `401`. 3. When the access token expires, call [`POST /refresh-exchanges`](/products-and-customers/authentication/post-auth-refresh) with `{"refresh_token": ""}`. No headers are needed. It returns a new `auth_token` and a new `refresh_token`. Each refresh token works once, so store the new one. If the refresh token has expired or was already used, start again at step 1. Only partners can get a token: `key` is the partner's `payme_client_key`, and a seller without a partner key can't call this API. What the MPL (`seller_payme_id`) and the partner key are: Payments [Authentication and environments](/payments/getting-started/authentication).