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

# Authentication

> Learn how to authenticate your API requests using API keys

<Tip>
  **Skip writing auth + pagination boilerplate** — install the [official AI agent skill](https://github.com/kaitoInfra/twitterapi-io) and let Claude Code, Cursor, Copilot, etc. handle it:

  ```bash theme={null}
  npx skills add kaitoInfra/twitterapi-io
  ```
</Tip>

## API Authentication

Every API request requires authentication using an API key in the HTTP headers.

### Getting Your API Key

1. Log in to your [TwitterApiIO Dashboard](https://twitterapi.io/dashboard)
2. Find your API key displayed on the dashboard homepage

### Using Your API Key

All API requests must include the `x-api-key` header for authentication.

Header format:

```
x-api-key: YOUR_API_KEY
```

Example requests:

#### cURL

```bash theme={null}
curl --location 'https://api.twitterapi.io/twitter/user/followings?userName=KaitoEasyAPI' \
--header 'x-api-key: my_test_xxxxx'
```

#### Python

```python theme={null}
import requests

url = 'https://api.twitterapi.io/twitter/user/followings?userName=KaitoEasyAPI'
headers = {'x-api-key': 'my_test_xxxxx'}
response = requests.get(url, headers=headers)
print(response.json())
```

#### Java

```java theme={null}
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
    .url("https://api.twitterapi.io/twitter/user/followings?userName=KaitoEasyAPI")
    .addHeader("x-api-key", "my_test_xxxxx")
    .build();

try (Response response = client.newCall(request).execute()) {
    System.out.println(response.body().string());
} catch (Exception e) {
    e.printStackTrace();
}
```
