# Authentication Patterns

**Analysis Date**: 2025-09-30T11:32:38.806Z

## Summary

- **Total Requests Analyzed**: 32
- **Authentication Headers Found**: 1
- **Unique User-Agent Values**: 1

## Authentication Header Analysis

### `x-api-key`

- **Usage Count**: 32 (100.0% of requests)
- **Value Pattern**: `[REDACTED]` (sensitive data automatically redacted in logs)
- **Used in Endpoints**:
  - `/v2/conversations`
  - `/v2/conversations/test-conv-123`
  - `/v2/conversations/test-conv-123/end`
  - `/v2/conversations/c72e4297abdca464/end`
  - `/v2/conversations/c09e9fe1725f04bb/end`
  - `/v2/conversations/c0cf3b72c3d0a4be/end`
  - `/v2/conversations/c5b8810472b8145a/end`
  - `/v2/conversations/c37714cdfcba3416/end`
  - `/v2/conversations/c50273f91417c440/end`
  - `/v2/conversations/ce60b0651777440e/end`
  - `/v2/replicas`
  - `/v2/conversations/cb08dc788a83f4c3/end`

## User-Agent Analysis

The following User-Agent values were observed:

- `BuzzTrail-Widget/1.0`

**Total User-Agent headers found**: 2


## Request Header Patterns

### Standard Headers

All requests include the following standard headers:

- **`Content-Type`**: Always `application/json`
- **`x-api-key`**: Present in all requests, contains authentication token

### Custom Headers

The following custom headers were observed:

- `User-Agent`


## Authentication Flow

### API Key Authentication

The Tavus API uses **API Key authentication** via the `x-api-key` header:

```http
POST /v2/conversations HTTP/1.1
Host: tavusapi.com
Content-Type: application/json
x-api-key: [YOUR_API_KEY]
```

### Key Observations

1. **Consistency**: All 32 requests use the same authentication method
2. **Header Name**: Authentication uses `x-api-key` (lowercase 'x', hyphenated)
3. **Security**: API keys are automatically redacted in logs with value `[REDACTED]`
4. **No Bearer Tokens**: No `Authorization: Bearer` headers observed
5. **No OAuth**: No OAuth flows or token endpoints observed

## Rate Limiting Headers

The following rate-limiting related headers were observed in responses:

- `x-rate-limit-remaining`

Example value from logs: `999`


## Recommendations for Mock Server

1. **Implement x-api-key validation**: Check for presence and format of `x-api-key` header
2. **Redact sensitive data**: Continue redacting API keys in logs with `[REDACTED]` pattern
3. **Return rate limit headers**: Include `x-rate-limit-remaining` in responses for realism
4. **Support User-Agent**: Accept and log User-Agent headers when provided
5. **Standard Content-Type**: Expect and validate `application/json` content type

## Security Patterns

### Observed Security Practices

- API keys are redacted in all log files
- HTTPS endpoints used exclusively (`https://tavusapi.com`)
- No sensitive data in URL parameters (all in request body)
- Authentication required for all endpoints

### Authentication Error Handling

Based on the logs analyzed, no authentication errors were captured. All 32 requests successfully authenticated. The mock server should implement:

- **401 Unauthorized**: When `x-api-key` is missing or invalid
- **403 Forbidden**: When API key is valid but lacks permissions
- **429 Too Many Requests**: When rate limits are exceeded
