---
title: "Authenticate the SDK"
url: https://docs.truemarkets.co/sdks/authentication
description: "Point TM_KEY_FILE at your key file and the SDK mints and refreshes tokens for you."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Authenticate the SDK

Point `TM_KEY_FILE` at your key file and the SDK mints and refreshes tokens for you. Both SDKs read it from your environment. The Python SDK also loads a `.env` file; with TypeScript, run Node or Bun with `--env-file=.env`.

If you don't have a key file yet, see [Create your API key](https://docs.truemarkets.co/trading-api/api-key).

.env: the two variables the SDKs read

```sh
# .env
TM_ENV=prod
TM_KEY_FILE=/path/to/your-api-key.json
```

| Variable | Purpose |
| --- | --- |
| `TM_KEY_FILE` | Path to the downloaded API key file (JSON, contains `key_id` and the private JWK) |
| `TM_ENV` | Which environment to target, e.g. `prod` |

> **Treat the key file like a password**
> 
> Anyone with the key file can mint tokens as you. Keep it out of git and out of shared environments. If it leaks, revoke the key and create a new one at [app.truemarkets.co](https://app.truemarkets.co/).

* * *

**[Next: Quickstart](https://docs.truemarkets.co/sdks/quickstart)**