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

# Authentication

> Learn about API authentication and security considerations for Perplexica

## Overview

Perplexica currently **does not require authentication** for API requests. The application is designed for self-hosted deployments where security is managed at the network and infrastructure level.

<Info>
  Authentication is planned as an upcoming feature. Check the [GitHub repository](https://github.com/ItzCrazyKns/Perplexica) for updates on authentication implementation.
</Info>

## Current security model

Since Perplexica is self-hosted, you control the security perimeter:

<CardGroup cols={2}>
  <Card title="Network isolation" icon="network-wired">
    Run Perplexica on a private network accessible only to trusted users
  </Card>

  <Card title="Reverse proxy" icon="shield-halved">
    Use nginx or Caddy with basic auth or OAuth for access control
  </Card>

  <Card title="Firewall rules" icon="fire">
    Configure firewall to restrict access to port 3000
  </Card>

  <Card title="VPN access" icon="lock">
    Require VPN connection to access your Perplexica instance
  </Card>
</CardGroup>

## Making API requests

Without authentication, you can make direct requests to any endpoint:

```bash theme={null}
curl -X POST http://localhost:3000/api/search \
  -H "Content-Type: application/json" \
  -d '{
    "chatModel": {
      "providerId": "550e8400-e29b-41d4-a716-446655440000",
      "key": "gpt-4o-mini"
    },
    "embeddingModel": {
      "providerId": "550e8400-e29b-41d4-a716-446655440000",
      "key": "text-embedding-3-large"
    },
    "optimizationMode": "balanced",
    "sources": ["web"],
    "query": "What is Perplexica?"
  }'
```

<Note>
  Replace `localhost:3000` with your Perplexica instance URL if accessing remotely.
</Note>

## Security best practices

### Network-level protection

When exposing Perplexica to the internet, implement security measures:

<Steps>
  <Step title="Use a reverse proxy">
    Configure nginx, Apache, or Caddy to handle SSL/TLS and add authentication:

    ```nginx theme={null}
    server {
        listen 443 ssl;
        server_name perplexica.example.com;

        ssl_certificate /path/to/cert.pem;
        ssl_certificate_key /path/to/key.pem;

        # Basic authentication
        auth_basic "Perplexica Access";
        auth_basic_user_file /etc/nginx/.htpasswd;

        location / {
            proxy_pass http://localhost:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
        }
    }
    ```
  </Step>

  <Step title="Enable HTTPS">
    Use Let's Encrypt or your certificate provider to enable HTTPS for encrypted communication.
  </Step>

  <Step title="Configure CORS">
    If accessing the API from web applications, configure appropriate CORS policies at the reverse proxy level.
  </Step>

  <Step title="Monitor access logs">
    Review access logs regularly to detect unauthorized access attempts.
  </Step>
</Steps>

### Docker security

When running Perplexica with Docker:

* **Bind to localhost only**: Use `-p 127.0.0.1:3000:3000` instead of `-p 3000:3000`
* **Use Docker networks**: Create isolated networks for Perplexica and SearxNG
* **Set resource limits**: Prevent resource exhaustion with `--memory` and `--cpus` flags
* **Run as non-root**: The Perplexica Docker image runs as a non-root user by default

```bash theme={null}
# Example: Secure Docker deployment
docker run -d \
  -p 127.0.0.1:3000:3000 \
  --memory="2g" \
  --cpus="2" \
  -v perplexica-data:/home/perplexica/data \
  --name perplexica \
  itzcrazykns1337/perplexica:latest
```

### API key protection

While Perplexica doesn't require authentication, it stores sensitive API keys for LLM providers:

<Warning>
  Never expose your Perplexica instance publicly without additional security measures. Your configured API keys (OpenAI, Claude, etc.) could be misused.
</Warning>

* Store API keys in environment variables, not in configuration files
* Use read-only file permissions for configuration files
* Rotate API keys periodically
* Monitor API usage on provider dashboards

## Future authentication

Authentication is planned as an upcoming feature. The implementation may include:

* User accounts and session management
* API key generation for programmatic access
* Role-based access control (admin, user, read-only)
* Integration with external authentication providers (OAuth, SAML)

<Info>
  Follow the [GitHub repository](https://github.com/ItzCrazyKns/Perplexica) and join the [Discord community](https://discord.gg/26aArMy8tT) to stay updated on authentication implementation progress.
</Info>

## Rate limiting

Currently, Perplexica does not implement built-in rate limiting. For production deployments:

1. **Reverse proxy rate limiting**: Use nginx `limit_req` module or similar
2. **Cloud load balancers**: AWS ALB, Cloudflare, etc. provide rate limiting features
3. **Provider limits**: Be aware of rate limits from your LLM providers (OpenAI, Anthropic, etc.)

Example nginx rate limiting:

```nginx theme={null}
http {
    limit_req_zone $binary_remote_addr zone=perplexica:10m rate=10r/s;

    server {
        location /api/ {
            limit_req zone=perplexica burst=20 nodelay;
            proxy_pass http://localhost:3000;
        }
    }
}
```

## Related pages

<CardGroup cols={2}>
  <Card title="API overview" icon="book" href="/api/overview">
    Learn about API endpoints and usage
  </Card>

  <Card title="Deployment" icon="rocket" href="/deployment/docker">
    Deploy Perplexica securely
  </Card>

  <Card title="Configuration" icon="gear" href="/configuration/environment-variables">
    Configure environment variables
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/deployment/troubleshooting">
    Resolve common issues
  </Card>
</CardGroup>
