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

# Authentication

> Secure your API requests with StudyFetch authentication

# Authentication

All requests to the StudyFetch API require authentication using an API key. This guide covers how to obtain and use your API key across different platforms.

## Obtaining Your API Key

### Via StudyFetch Dashboard

1. Log in to your [StudyFetch Console](https://console.studyfetch.com)
2. Click **API Keys**
3. Click **Create New API Key**
4. Give your key a descriptive name (e.g., "Production App")
5. Copy the generated key

## Using Your API Key

The StudyFetch API uses API key authentication via the `x-api-key` header.

### Header Format

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

### Example Requests

<CodeGroup>
  ```javascript JavaScript theme={null}
  import StudyfetchSDK from '@studyfetch/sdk';

  const client = new StudyfetchSDK({
    apiKey: 'YOUR_API_KEY',
    baseURL: 'https://studyfetchapi.com',
  });

  // The SDK automatically includes the x-api-key header
  const components = await client.v1.components.list();
  ```

  ```python Python theme={null}
  from studyfetch_sdk import StudyfetchSDK

  client = StudyfetchSDK(
      api_key="YOUR_API_KEY",
      base_url="https://studyfetchapi.com",
  )

  # The SDK automatically includes the x-api-key header
  components = client.v1.components.list()
  ```

  ```java Java theme={null}
  import com.studyfetch.javasdk.client.StudyfetchSdkClient;
  import com.studyfetch.javasdk.client.okhttp.StudyfetchSdkOkHttpClient;

  StudyfetchSdkClient client = StudyfetchSdkOkHttpClient.builder()
      .apiKey("YOUR_API_KEY")
      .baseUrl("https://studyfetchapi.com")
      .build();

  // The SDK automatically includes the x-api-key header
  var components = client.v1().components().list();
  ```

  ```bash cURL theme={null}
  curl https://studyfetchapi.com/api/v1/components \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>
