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

# 2. Authentication Basics

To authenticate with Encord you must register a public key in the Encord platform. See [our documentation here](/platform-documentation/General/general-access-keys) to learn more. Users can only access Projects, Datasets, and Ontologies from within their [Workspace](/platform-documentation/General/general-workspace-settings).

<Info>Authentication must occur every time an SDK script is run.</Info>

<Info>Ensure your private key is not password protected. All private keys generated on the Encord platform as described in [our documentation](/platform-documentation/General/general-access-keys) are not password protected by default.</Info>

After registering a public key, use the corresponding private key to authenticate your [EncordUserClient](/sdk-documentation/sdk-references/user_client). The following code sample needs to be included in all SDK interactions, and hence is included in all code snippets we provide in these tutorials.

<Tip>We recommend using the file path to your private key, rather than the private key itself when authenticating.</Tip>

The following script must be added to all Encord SDK scripts. It is present in all complete code examples we provide.

<CodeGroup>
  ```python Template theme={"dark"}
  # Import dependencies
  from encord import EncordUserClient

  # Authenticate with Encord using the path to your private key
  user_client = EncordUserClient.create_with_ssh_private_key(
      ssh_private_key_path="<private_key_path>"
      )
  ```

  ```python Example Global theme={"dark"}

  # Import dependencies
  from encord import EncordUserClient

  # Authenticate with Encord using the path to your private key
  user_client = EncordUserClient.create_with_ssh_private_key(
      ssh_private_key_path="/Users/chris-encord/sdk-ssh-private-key"
      )

  ```
</CodeGroup>

## US Customers

If you are using Encord's US based hosted platform, ALL authentication for the SDK MUST include the following:

```python theme={"dark"}
domain="https://api.us.encord.com"
```

<CodeGroup>
  ```python Template theme={"dark"}

  # Import dependencies
  from encord import EncordUserClient

  # Authenticate with Encord using the path to your private key
  user_client = EncordUserClient.create_with_ssh_private_key(
      ssh_private_key_path="<private_key_path>",
      domain="https://api.us.encord.com",
  )
  ```

  ```python Example US Domain theme={"dark"}

  # Import dependencies
  from encord import EncordUserClient

  # Authenticate with Encord using the path to your private key
  user_client = EncordUserClient.create_with_ssh_private_key(
      ssh_private_key_path="/Users/chris-encord/sdk-ssh-private-key",
      domain="https://api.us.encord.com",
      )

  ```
</CodeGroup>
