> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.repliers.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Repliers API Authentication Guide

## Overview

All API requests must include authentication using your unique API key. This key identifies your account and ensures secure access to our services.

## Authentication Methods

You can authenticate using either of these methods:

### Method 1: Header Authentication (Recommended)

Include your API key in the request headers:

```
REPLIERS-API-KEY: {your_api_key_here}
```

### Method 2: Query String Parameter

Alternatively, you can pass your API key as a query parameter:

```
https://api.repliers.io/listings?repliers_api_key={your_api_key_here}
```

**Note:** Header authentication is recommended as it's more secure and keeps your API key out of server logs and browser history.

## Implementation Examples

### Using cURL

**Header Authentication:**

```
curl -X GET "https://api.repliers.io/listings" \
  -H "REPLIERS-API-KEY: your_actual_api_key_here" \
  -H "Content-Type: application/json"
```

**Query Parameter Authentication:**

```
curl -X GET "https://api.repliers.io/listings?repliers_api_key=your_actual_api_key_here" \
  -H "Content-Type: application/json"
```

### Using JavaScript (fetch)

**Header Authentication:**

```
const response = await fetch('https://api.repliers.io/listings', {
  method: 'GET',
  headers: {
    'REPLIERS-API-KEY': 'your_actual_api_key_here',
    'Content-Type': 'application/json'
  }
});
```

**Query Parameter Authentication:**

```
const apiKey = 'your_actual_api_key_here';
const response = await fetch(`https://api.repliers.io/listings?repliers_api_key=${apiKey}`, {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
});
```

### Using Python (requests)

**Header Authentication:**

```
import requests

headers = {
    'REPLIERS-API-KEY': 'your_actual_api_key_here',
    'Content-Type': 'application/json'
}

response = requests.get('https://api.repliers.io/listings', headers=headers)
```

**Query Parameter Authentication:**

```
import requests

params = {
    'repliers_api_key': 'your_actual_api_key_here'
}

response = requests.get('https://api.repliers.io/listings', params=params)
```

### Using Node.js (axios)

**Header Authentication:**

```
const axios = require('axios');

const config = {
  headers: {
    'REPLIERS-API-KEY': 'your_actual_api_key_here',
    'Content-Type': 'application/json'
  }
};

const response = await axios.get('https://api.repliers.io/listings', config);
```

**Query Parameter Authentication:**

```
const axios = require('axios');

const response = await axios.get('https://api.repliers.io/listings', {
  params: {
    repliers_api_key: 'your_actual_api_key_here'
  }
});
```

## Finding Your API Key

1. Log into the [Developer Portal](https://login.repliers.com)
2. Navigate to the "API Keys" 
3. Your API key will be displayed or can be generated if you don't have one yet

## Important Security Notes

* **Never expose your API key in client-side code** or public repositories unless it's a [client-side API Key](https://help.repliers.com/en/article/client-side-api-keys-developer-guide-11b1t5s/)
* **Use header authentication when possible** as it's more secure than query parameters
* When using query parameters, be aware that API keys may appear in server logs and browser history
* Store your API key securely using environment variables or secure configuration files
* Regenerate your API key immediately if you suspect it has been compromised
* Use different API keys for different environments (development, staging, production)

## Error Responses

If authentication fails, you'll receive one of these error responses:

### Invalid API Key (401 Unauthorized)

```
{
  "error": "Invalid API key",
  "message": "The provided API key is not valid"
}
```

### Best Practices

* Always use HTTPS when making API requests to protect your API key in transit
* Implement proper error handling for authentication failures
* Consider implementing API key rotation for enhanced security
* Monitor your API usage to detect any unauthorized access
* Set up rate limiting on your applications to avoid exceeding API limits

## Need Help?

If you're experiencing authentication issues:

1. Verify your API key is correctly formatted and hasn't expired
2. Check that you're including the header name exactly as shown: `REPLIERS-API-KEY`
3. Ensure you're using HTTPS endpoints
4. Follow up with us if problems persist

Remember to replace `your_actual_api_key_here` with your real API key in all examples above.

# What questions does this article answer?

* How does authentication work when calling the Repliers API?  
* Where do I find or generate my API key in the Developer Portal?  
* How do I send my API key in requests (headers vs query parameters)?   
* How should I securely store my API keys (environment variables, config management, etc.)?  
* What should I do if I suspect my API key has been exposed or compromised?  
* How do I authenticate requests to Repliers APIs?  
* What is my API key?  
* What’s the recommended method: header vs query string authentication?  
* What are security best practices for storing and using my API key?