# API Documentation

## Additional APIs

### POST /api/v1/messages

Anthropic Messages-compatible endpoint with Mnexium features (history, recall, learn, prompts, memory policies, state).

**Scope:** `chat:write`

**Headers:**
- `x-api-key`: required - Anthropic API key.
- `x-mnexium-key`: required - Mnexium API key.
- `x-mnx-memory-policy`: optional - Memory policy override (policy ID or `false`).

**Request Body:**

```json
{
  "model": "claude-sonnet-4-20250514",
  "messages": [{ "role": "user", "content": "Remember that I prefer morning meetings." }],
  "mnx": { "subject_id": "user_123", "history": true, "learn": true, "recall": true }
}
```

**cURL Example:**

```bash
curl -X POST "https://www.mnexium.com/api/v1/messages" \
  -H "x-mnexium-key: $MNX_KEY" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "x-mnx-memory-policy: mp_support_assistant" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "messages": [{ "role": "user", "content": "Remember that I prefer morning meetings." }],
    "mnx": { "subject_id": "user_123", "history": true, "learn": true, "recall": true }
  }'
```

---

### GET /api/v1/audit/requests

Query raw request/response audit logs (including provider payloads and injected memory metadata).

**Scope:** `audit:read`

**Query Parameters:**
- `audit_id`: string - Get one record by ID.
- `chat_id`: string - Filter by chat.
- `subject_id`: string - Filter by subject.
- `direction`: string - request or response.
- `request_type`: string - chat, responses, or messages.
- `limit`: number - Default: 100, Max: 1000.
- `offset`: number - Pagination offset.
