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

# Authentication

> Authenticate with the Linkup API

<Card title="Get your API key" icon="key" href="https://app.linkup.so" horizontal="True">
  Create a Linkup account for free to get your API key.
</Card>

<Tip>
  **No API key?** You can also access the Linkup API using the [x402 payment protocol](/pages/documentation/platform/x402): pay per request in USDC, no account needed.
</Tip>

## Using cURL

Your API key needs to be sent with every request as a Bearer token in the `Authorization` header.

```shell curl theme={"system"}
curl "https://api.linkup.so/v1/search" \
    -G \
    -H "Authorization: Bearer <YOUR_LINKUP_API_KEY>" \
    ...
```

## Using the Python SDK

**Option 1:** Set a `LINKUP_API_KEY` environment variable in your shell before using the SDK.

```shell shell theme={"system"}
export LINKUP_API_KEY='<YOUR_LINKUP_API_KEY>'
```

**Option 2:**  Set the `LINKUP_API_KEY` environment variable directly within Python, using for instance `os.environ` or [python-dotenv](https://github.com/theskumar/python-dotenv).

```python python theme={"system"}
import os
from linkup import LinkupClient

os.environ["LINKUP_API_KEY"] = "<YOUR_LINKUP_API_KEY>"
# or dotenv.load_dotenv()
client = LinkupClient()
...
```

**Option 3**: Directly pass the Linkup API key to the Linkup Client.

```python python theme={"system"}
from linkup import LinkupClient

client = LinkupClient(api_key="<YOUR_LINKUP_API_KEY>")
...
```

## Using the JS SDK

Pass the Linkup API key to the Linkup Client.

```js js theme={"system"}
import { LinkupClient } from 'linkup-sdk';

const client = new LinkupClient({
  apiKey: '<YOUR_LINKUP_API_KEY>',
});
```

## Using the CLI

The CLI can store your API key locally with the interactive setup flow:

```shell shell theme={"system"}
linkup setup
```

For scripts and CI, set `LINKUP_API_KEY` in the environment. The environment variable takes precedence over the local config file at `~/.linkup/config`.

```shell shell theme={"system"}
LINKUP_API_KEY='<YOUR_LINKUP_API_KEY>' linkup search "What is Microsoft's 2024 revenue?"
```

<Info>
  **Need help?** Email `support@linkup.so`, ping us on [Discord](https://discord.com/invite/9q9mCYJa86), or [talk to us](https://calendar.app.google/zNUZz7RxgMMk9pKW7).
</Info>
