# get_api_key

> **Function** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/utils/get_api_key)

Get the API key from the environment or the given value.

## Signature

```python
get_api_key(
    api_key: Optional[str],
) -> Optional[str]
```

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/19dc497a3d89638e4cc35db72ea1c29cad35cbbf/python/langsmith/utils.py#L828)