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

# API Overview

> Complete API reference for the Cognitive Learning Engine

## Getting Started

The Cognitive Learning Engine provides a RESTful API for integrating cognitive intelligence into your EdTech platform.

## Base URL

<CodeGroup>
  ```bash Production theme={null}
  https://api.prepst.com
  ```

  ```bash Development theme={null}
  http://localhost:8000
  ```
</CodeGroup>

## Authentication

All API requests require an API key in the header:

```bash theme={null}
X-API-Key: your-api-key-here
```

<Info>
  Get your API key by contacting support or signing up for an account.
</Info>

## Response Format

All API responses follow this structure:

```json theme={null}
{
  "success": true,
  "data": { },
  "message": "Operation successful"
}
```

### Error Responses

```json theme={null}
{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Invalid user_id provided"
  }
}
```

## Rate Limits

<Warning>
  API rate limits: 100 requests per minute per API key
</Warning>

## Core Endpoints

<CardGroup cols={2}>
  <Card title="Track Answer" icon="pencil" href="/api-reference/endpoint/track-answer">
    Record learning events and update mastery
  </Card>

  <Card title="Get Predictions" icon="crystal-ball" href="/api-reference/endpoint/predictions">
    Retrieve score predictions and goal tracking
  </Card>

  <Card title="Learning Velocity" icon="gauge" href="/api-reference/endpoint/velocity">
    Analyze learning momentum and trends
  </Card>

  <Card title="Health Check" icon="heart-pulse" href="/api-reference/endpoint/health">
    Monitor service health
  </Card>
</CardGroup>

## SDK Support

<CodeGroup>
  ```python Python SDK theme={null}
  pip install cognition-engine-sdk
  ```

  ```javascript JavaScript SDK theme={null}
  npm install cognition-engine
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.prepst.com/api/v1/track-answer" \
    -H "X-API-Key: your-key" \
    -d '{"user_id": "student", "skill_id": "math", "is_correct": true}'
  ```
</CodeGroup>

## Quick Start Example

```python theme={null}
from cognition_engine import CognitionEngine

# Initialize
engine = CognitionEngine(
    supabase_url="your-supabase-url",
    supabase_key="your-supabase-key"
)

# Track learning event
result = await engine.track_answer(
    user_id="student_123",
    skill_id="algebra_001",
    is_correct=True,
    time_spent_seconds=45,
    confidence_score=4
)

# Get predictions
predictions = await engine.get_predictions("student_123")
print(f"Predicted score: {predictions['predicted_total_in_30_days']}")
```

## Support

<CardGroup cols={2}>
  <Card title="Documentation" icon="book" href="/guides/overview">
    Browse guides and tutorials
  </Card>

  <Card title="Contact Support" icon="envelope" href="mailto:support@cognition-engine.com">
    Get help from our team
  </Card>
</CardGroup>
