-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI_DOCUMENTATION.txt
More file actions
171 lines (125 loc) · 3.16 KB
/
Copy pathAPI_DOCUMENTATION.txt
File metadata and controls
171 lines (125 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# PromptMaster Pro API Documentation
## Base URL
http://localhost:3000/api
## Authentication
Most endpoints require a JWT token. Include it in the Authorization header:
Authorization: Bearer <your_jwt_token>
---
## Rate Limiting
- General API: 100 requests per 15 minutes
- Authentication: 5 requests per 15 minutes
- AI Generation: 20 requests per 15 minutes
---
## AUTHENTICATION ENDPOINTS
### Register User
POST /api/auth/register
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "password123",
"preferredLanguage": "en"
}
Validation Rules:
- name: Required, 2-100 characters
- email: Required, valid email format
- password: Required, minimum 6 characters
- preferredLanguage: Optional, one of: en, am, om, ti
---
### Login
POST /api/auth/login
Request Body:
{
"email": "john@example.com",
"password": "password123"
}
---
### Get Profile
GET /api/auth/profile
Headers: Authorization: Bearer <token>
---
## PROMPT ENDPOINTS
### Create Prompt
POST /api/prompts
Headers: Authorization: Bearer <token>
Request Body:
{
"inputText": "Explain quantum computing",
"promptText": "Please explain quantum computing in simple terms",
"languageInput": "en",
"languageOutput": "en",
"category": "Education"
}
Validation Rules:
- inputText: Required, max 5000 characters
- promptText: Required, max 10000 characters
- languageInput: Optional, one of: en, am, om, ti
- languageOutput: Optional, one of: en, am, om, ti
- category: Optional, max 50 characters
---
### Get User Prompts
GET /api/prompts?category=Education&favorite=true&limit=10&offset=0
Headers: Authorization: Bearer <token>
Query Parameters:
- category (optional): Filter by category
- favorite (optional): Filter favorites (true/false)
- limit (optional): Number of results (1-100, default: 50)
- offset (optional): Pagination offset (default: 0)
---
### Get Prompt by ID
GET /api/prompts/:id
Headers: Authorization: Bearer <token>
---
### Delete Prompt
DELETE /api/prompts/:id
Headers: Authorization: Bearer <token>
---
### Toggle Favorite
PATCH /api/prompts/:id/favorite
Headers: Authorization: Bearer <token>
---
### Improve Prompt
POST /api/prompts/improve
Headers: Authorization: Bearer <token>
Request Body:
{
"promptText": "ስለ ቡና ጻፍ",
"language": "am"
}
Response:
{
"status": "success",
"data": {
"originalInput": "ስለ ቡና ጻፍ",
"improvedEnglish": "Write a detailed article about the history, cultural significance, and preparation ceremony of Ethiopian coffee.",
"improvedLocal": "ስለ ኢትዮጵያ ቡና ታሪክ፣ ባህላዊ ጠቀሜታ እና የአፈላል ሥነ-ሥርዓት ዝርዝር ጽሑፍ ጻፍ።",
"language": "am"
}
}
---
## TEMPLATE ENDPOINTS
### Get All Templates
GET /api/templates
---
### Get Templates by Category
GET /api/templates/category/:category
Example: GET /api/templates/category/Education
---
### Get Template by ID
GET /api/templates/:id
---
## ERROR RESPONSES
400 - Validation Error
401 - Unauthorized
404 - Not Found
429 - Rate Limit Exceeded
500 - Server Error
---
## SUPPORTED LANGUAGES
- en - English
- am - Amharic
- om - Oromo
- ti - Tigrinya
---
## HEALTH CHECK
GET /health