# Authentication

## Authentication

All API requests require authentication using an API key.

***

### Getting Your API Key

1. Log in to your [PlainProxies Dashboard](https://dashboard.plainproxies.com)
2. Navigate to **Account** → **API Keys**
3. Click **Generate New Key**
4. Copy and securely store your key

***

### Using Your API Key

Include your API key in the `X-API-KEY` header with every request:

```bash
curl -X GET "https://dashboard.plainproxies.com/api/user/auth/me" \
  -H "X-API-KEY: PlainProxies_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  -H "Content-Type: application/json"
```

***

### API Key Format

API keys follow this format:

```
PlainProxies_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```

The prefix `PlainProxies_` is followed by a UUID.

***

### Security Best Practices

{% hint style="danger" %}
Never expose your API key in client-side code, public repositories, or logs.
{% endhint %}

#### Do

* Store API keys in environment variables
* Use server-side code to make API calls
* Rotate keys periodically
* Use separate keys for development and production

#### Don't

* Commit API keys to version control
* Share keys via email or chat
* Use the same key across multiple applications
* Include keys in URLs or query parameters

***

### Verifying Your Key

Test your API key by calling the authentication endpoint:

```bash
curl -X GET "https://dashboard.plainproxies.com/api/user/auth/me" \
  -H "X-API-KEY: YOUR_API_KEY"
```

**Success Response:**

```json
{
  "success": true,
  "data": {
    "uuid": "550e8400-e29b-41d4-a716-446655440000",
    "username": "your_username",
    "email": "you@example.com",
    "is_reseller": false,
    "created_at": "2024-01-15T10:30:00+00:00"
  }
}
```

**Error Response (Invalid Key):**

```json
{
  "success": false,
  "error": {
    "code": "INVALID_API_KEY",
    "message": "Invalid API key"
  }
}
```

***

### Managing Multiple Keys

You can create up to **5 API keys** per account. Use different keys for:

* Development vs. production environments
* Different applications or services
* Team members (if managing shared access)

To manage your keys, visit [API Keys Settings](https://dashboard.plainproxies.com/account/api-keys).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plainproxies.com/getting-started/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
