1// API Documentation
2export const API_DOCS_MD = String.raw`
3# REST API Documentation
4
5## ๐ Authentication
6
7All API requests require authentication using **Bearer tokens**. Include your API key in the Authorization header:
8
9${'```'}http
10GET /api/v1/users
11Host: api.example.com
12Authorization: Bearer YOUR_API_KEY
13Content-Type: application/json
14${'```'}
15
16## ๐ Endpoints
17
18### Users API
19
20#### **GET** /api/v1/users
21
22Retrieve a paginated list of users.
23
24**Query Parameters:**
25
26| Parameter | Type | Default | Description |
27|-----------|------|---------|-------------|
28| page | integer | 1 | Page number |
29| limit | integer | 20 | Items per page |
30| sort | string | "created_at" | Sort field |
31| order | string | "desc" | Sort order |
32
33**Response:** 200 OK
34
35${'```'}json
36{
37 "data": [
38 {
39 "id": "usr_1234567890",
40 "email": "user@example.com",
41 "name": "John Doe",
42 "role": "admin",
43 "created_at": "2024-01-15T10:30:00Z"
44 }
45 ],
46 "pagination": {
47 "page": 1,
48 "limit": 20,
49 "total": 156,
50 "pages": 8
51 }
52}
53${'```'}
54
55#### **POST** /api/v1/users
56
57Create a new user account.
58
59**Request Body:**
60
61${'```'}json
62{
63 "email": "newuser@example.com",
64 "password": "SecurePassword123!",
65 "name": "Jane Smith",
66 "role": "user"
67}
68${'```'}
69
70**Response:** 201 Created
71
72${'```'}json
73{
74 "id": "usr_9876543210",
75 "email": "newuser@example.com",
76 "name": "Jane Smith",
77 "role": "user",
78 "created_at": "2024-01-21T09:15:00Z"
79}
80${'```'}
81
82### Error Responses
83
84The API returns errors in a consistent format:
85
86${'```'}json
87{
88 "error": {
89 "code": "VALIDATION_ERROR",
90 "message": "Invalid request parameters",
91 "details": [
92 {
93 "field": "email",
94 "message": "Email format is invalid"
95 }
96 ]
97 }
98}
99${'```'}
100
101### Rate Limiting
102
103| Tier | Requests/Hour | Burst |
104|------|--------------|-------|
105| **Free** | 1,000 | 100 |
106| **Pro** | 10,000 | 500 |
107| **Enterprise** | Unlimited | - |
108
109**Headers:**
110- X-RateLimit-Limit
111- X-RateLimit-Remaining
112- X-RateLimit-Reset
113
114### Webhooks
115
116Configure webhooks to receive real-time events:
117
118${'```'}javascript
119// Webhook payload
120{
121 "event": "user.created",
122 "timestamp": "2024-01-21T09:15:00Z",
123 "data": {
124 "id": "usr_9876543210",
125 "email": "newuser@example.com"
126 },
127 "signature": "sha256=abcd1234..."
128}
129${'```'}
130
131### SDK Examples
132
133**JavaScript/TypeScript:**
134
135${'```'}typescript
136import { ApiClient } from '@example/api-sdk';
137
138const client = new ApiClient({
139 apiKey: process.env.API_KEY
140});
141
142const users = await client.users.list({
143 page: 1,
144 limit: 20
145});
146${'```'}
147
148**Python:**
149
150${'```'}python
151from example_api import Client
152
153client = Client(api_key=os.environ['API_KEY'])
154users = client.users.list(page=1, limit=20)
155${'```'}
156
157---
158
159๐ [Full API Reference](https://api.example.com/docs) | ๐ฌ [Support](https://support.example.com)
160`;