> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

The next step is to get your API key and account ID, which are needed to make calls to the Scale GP API
and to create, modify resources in the right place.

First navigate to the [SGP Admin](https://app.sgp.scale.com/admin/api-key) and grab your API key.
If you do not have an account provisioned by your organization or Scale, please contact the relevant System
administrator.

<Frame>
  <img src="https://files.readme.io/9a66e81-image.png" alt="Switch to Accounts and find the account ID." />
</Frame>

or via the UI by clicking on the "API Keys" tab in the admin dashboard.

<Frame>
  <img src="https://mintcdn.com/scalegp/LGE2JNGqt--hko9O/images/api_key_menu.png?fit=max&auto=format&n=LGE2JNGqt--hko9O&q=85&s=941446577ec194247ac2afdfd0aa607f" alt="API Key menu" width="3048" height="1002" data-path="images/api_key_menu.png" />
</Frame>

Next, switch to [Accounts](https://app.sgp.scale.com/admin/accounts) and find the account ID for the
account that you want to work with. You can also create a new account. Make sure to copy this ID to use it when
testing your setup.

<Frame>
  <img src="https://mintcdn.com/scalegp/LGE2JNGqt--hko9O/images/account_view.png?fit=max&auto=format&n=LGE2JNGqt--hko9O&q=85&s=9c7bccfd455da56a9af090ae3f5b22be" alt="You can also create a new account." width="2728" height="958" data-path="images/account_view.png" />
</Frame>

If you have an existing account but want to add Users to it, you can click into the account and add users.

<Frame>
  <img src="https://mintcdn.com/scalegp/LGE2JNGqt--hko9O/images/add_users.png?fit=max&auto=format&n=LGE2JNGqt--hko9O&q=85&s=95894946d54876ed70efa96a18b05610" alt="Click into the account to add users." width="3324" height="1346" data-path="images/add_users.png" />
</Frame>

You can also change the role of a user by clicking on the user and changing the role.

<Frame>
  <img src="https://mintcdn.com/scalegp/nt7p86_IWue4gDMA/images/change_role.png?fit=max&auto=format&n=nt7p86_IWue4gDMA&q=85&s=deba05c0c3e2343165d67396db959ec3" alt="Change the role of a user." width="2846" height="806" data-path="images/change_role.png" />
</Frame>

You can also remove a user by clicking on the remove button in the actions column.

<Frame>
  <img src="https://mintcdn.com/scalegp/9TXIMOtQYrZn6pT_/images/remove_user.png?fit=max&auto=format&n=9TXIMOtQYrZn6pT_&q=85&s=44d39e249da15ed3b36df93211bcdb3e" alt="Remove a user." width="2720" height="778" data-path="images/remove_user.png" />
</Frame>

## Storing Your Credentials

For security and convenience when using the SDK, it's recommended to store your API key and account ID as environment variables. This prevents accidentally exposing your credentials in code repositories.

<CodeGroup>
  ```bash macOS/Linux theme={null}
  export SGP_API_KEY="your-api-key-here"
  export SGP_ACCOUNT_ID="your-account-id-here"
  ```

  ```bash Windows (PowerShell) theme={null}
  $env:SGP_API_KEY="your-api-key-here"
  $env:SGP_ACCOUNT_ID="your-account-id-here"
  ```

  ```bash Windows (CMD) theme={null}
  set SGP_API_KEY=your-api-key-here
  set SGP_ACCOUNT_ID=your-account-id-here
  ```
</CodeGroup>

The SDK will automatically use the `SGP_API_KEY` and `SGP_ACCOUNT_ID` environment variables if they are set. Otherwise, you can pass them to the `SGPClient` constructor.

```python Python theme={null}
import os
from scale_gp_beta import SGPClient

client = SGPClient(
    account_id="your-account-id",
    api_key="your-api-key",
)
```

The `SGPClient` constructor accepts the following parameters:

| Parameter     | Description                                                                                                          | Default                               |
| ------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| `account_id`  | Your SGP account ID. Found in the [Accounts](https://app.sgp.scale.com/admin/accounts) tab of the admin dashboard.   | `SGP_ACCOUNT_ID` environment variable |
| `api_key`     | Your SGP API key. Found in the [API Keys](https://app.sgp.scale.com/admin/api-key) tab of the admin dashboard.       | `SGP_API_KEY` environment variable    |
| `environment` | The SGP environment to connect to. **Possible values:** `production-multitenant`, `staging`, `development`, `local`. | `production-multitenant`              |
| `base_url`    | Override the base URL with a custom endpoint. Takes precedence over `environment`.                                   | None                                  |

<Tip>
  To make the environment variables persist across sessions, add the export commands to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.bash_profile`).
</Tip>
