# API Documentation

**CashKey REST API Reference**

Comprehensive RESTful API guide for interacting with the CashKey platform programmatically.

## 🔑 Authentication

### Obtaining API Key

```bash
POST /api/v1/auth/login
Content-Type: application/json

{
  "telegram_id": "123456789",
  "username": "user123"
}
```

### Headers

```
Authorization: Bearer <your_jwt_token>
Content-Type: application/json
```

## 📝 Keys API

### Submit Keys

```bash
POST /api/v1/keys
{
  "title": "AI Trend Analysis",
  "content": "2024 AI market trends...",
  "category": "market_insights",
  "tags": ["AI", "Market", "2024"]
}
```

### Retrieve Keys

```bash
GET /api/v1/keys?limit=10&offset=0&category=market_insights
```

### Check Key Status

```bash
GET /api/v1/keys/{key_id}/status
```

## 👤 User API

### Profile Information

```bash
GET /api/v1/user/profile
```

### Points History

```bash
GET /api/v1/user/points?from=2024-01-01&to=2024-12-31
```

## 📊 Analytics API

### Dashboard Data

```bash
GET /api/v1/analytics/dashboard
```

### Trend Information

```bash
GET /api/v1/analytics/trends?period=7d
```

## 🔗 Webhooks

### Evaluation Complete Notification

```json
{
  "event": "evaluation_completed",
  "key_id": "uuid",
  "score": 145,
  "points_earned": 85,
  "timestamp": "2024-01-01T00:00:00Z"
}
```

## 📋 Response Formats

### Success Response

```json
{
  "success": true,
  "data": { ... },
  "message": "Success"
}
```

### Error Response

```json
{
  "success": false,
  "error": {
    "code": "INVALID_KEY",
    "message": "Key content is invalid"
  }
}
```

## 🚦 Rate Limits

* **Free Tier**: 100 requests/hour
* **Premium**: 1,000 requests/hour
* **Enterprise**: 10,000 requests/hour

***

> 🔧 **SDKs**: Python, JavaScript, Go SDKs coming soon


---

# 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://project-49.gitbook.io/cashkey/technical-documentation/api.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.
