Skip to content

Commit 7ff2407

Browse files
committed
fix: update API documentation to reflect JWT token usage and endpoint changes
1 parent 31b584d commit 7ff2407

4 files changed

Lines changed: 167 additions & 364 deletions

File tree

docs/api/analytics.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Get a comprehensive dashboard view of your search analytics.
4949
**Headers**:
5050

5151
```http
52-
Authorization: Bearer <YOUR_API_KEY>
52+
Authorization: Bearer <YOUR_JWT_TOKEN>
5353
```
5454

5555
**Response**:
@@ -136,7 +136,7 @@ Authorization: Bearer <YOUR_API_KEY>
136136

137137
Get detailed search trend analysis over time.
138138

139-
**Endpoint**: `GET /api/v1/analytics/trends`
139+
**Endpoint**: `GET /api/v1/analytics/search-trends`
140140

141141
**Query Parameters**:
142142

@@ -481,7 +481,7 @@ Get AI-powered insights and recommendations based on your search patterns.
481481

482482
Get comprehensive system-wide analytics and health metrics.
483483

484-
**Endpoint**: `GET /api/v1/analytics/overview`
484+
**Endpoint**: `GET /api/v1/analytics/admin/system-overview`
485485

486486
**Response**:
487487

@@ -545,7 +545,7 @@ Get comprehensive system-wide analytics and health metrics.
545545

546546
Get detailed user activity and engagement metrics.
547547

548-
**Endpoint**: `GET /api/v1/analytics/user-activity`
548+
**Endpoint**: `GET /api/v1/analytics/admin/user-activity`
549549

550550
**Query Parameters**:
551551

@@ -618,9 +618,7 @@ Get detailed user activity and engagement metrics.
618618

619619
### Create Custom Metrics
620620

621-
Define custom metrics for tracking specific KPIs.
622-
623-
**Endpoint**: `POST /api/v1/analytics/custom-metrics`
621+
_This feature is not currently implemented._
624622

625623
**Request Body**:
626624

@@ -644,9 +642,7 @@ Define custom metrics for tracking specific KPIs.
644642

645643
### Export Analytics Data
646644

647-
Export analytics data in various formats for external analysis.
648-
649-
**Endpoint**: `GET /api/v1/analytics/export`
645+
_This feature is not currently implemented._
650646

651647
**Query Parameters**:
652648

@@ -665,7 +661,7 @@ Export analytics data in various formats for external analysis.
665661
class Altus4Analytics {
666662
constructor(apiKey) {
667663
this.apiKey = apiKey;
668-
this.baseUrl = 'https://api.altus4.dev';
664+
this.baseUrl = 'http://localhost:3000';
669665
this.headers = {
670666
Authorization: `Bearer ${apiKey}`,
671667
'Content-Type': 'application/json',
@@ -776,7 +772,7 @@ from datetime import datetime, timedelta
776772
class Altus4AnalyticsDashboard:
777773
def __init__(self, api_key):
778774
self.api_key = api_key
779-
self.base_url = 'https://api.altus4.dev'
775+
self.base_url = 'http://localhost:3000'
780776
self.headers = {'Authorization': f'Bearer {api_key}'}
781777

782778
def get_dashboard_data(self, period='week'):

docs/api/authentication.md

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ Altus 4 uses API key-based authentication for all service integration. This prov
1414
### Authentication Flow
1515

1616
1. **Register** a new user account
17-
2. **Login** to get a bootstrap JWT token (one-time use)
18-
3. **Create** your first API key using the JWT token
19-
4. **Use API key** for all subsequent requests
17+
2. **Login** to get a JWT token
18+
3. **Create** API keys using the JWT token for search operations
19+
4. **Use JWT tokens** for user management and database operations
20+
5. **Use API keys** for search operations and analytics
2021

2122
```mermaid
2223
graph TD
@@ -71,22 +72,29 @@ Content-Type: application/json
7172
{
7273
"success": true,
7374
"data": {
74-
"id": "user_abc123",
75-
"email": "user@example.com",
76-
"name": "John Doe",
77-
"createdAt": "2024-01-15T10:30:00.000Z"
75+
"user": {
76+
"id": "dc6e0cee-efe8-4134-be55-249d6a36ae19",
77+
"email": "user@example.com",
78+
"name": "John Doe",
79+
"role": "user",
80+
"connectedDatabases": [],
81+
"createdAt": "2025-09-06T16:19:56.195Z",
82+
"lastActive": "2025-09-06T16:19:56.195Z"
83+
},
84+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
7885
},
7986
"meta": {
80-
"timestamp": "2024-01-15T10:30:00.000Z",
81-
"requestId": "req_abc123"
87+
"timestamp": "2025-09-06T16:19:56.197Z",
88+
"requestId": "1b53d9d6-ca2e-4b99-959b-8459820475b4",
89+
"version": "0.3.0"
8290
}
8391
}
8492
```
8593

8694
**cURL Example**:
8795

8896
```bash
89-
curl -X POST https://api.altus4.dev/api/v1/auth/register \
97+
curl -X POST http://localhost:3000/api/v1/auth/register \
9098
-H "Content-Type: application/json" \
9199
-d '{
92100
"email": "user@example.com",
@@ -123,23 +131,28 @@ Content-Type: application/json
123131
"success": true,
124132
"data": {
125133
"user": {
126-
"id": "user_abc123",
134+
"id": "dc6e0cee-efe8-4134-be55-249d6a36ae19",
127135
"email": "user@example.com",
128-
"name": "John Doe"
136+
"name": "John Doe",
137+
"role": "user",
138+
"connectedDatabases": [],
139+
"createdAt": "2025-09-06T16:19:56.195Z",
140+
"lastActive": "2025-09-06T16:19:56.195Z"
129141
},
130-
"tokens": {
131-
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
132-
"refreshToken": "rt_def456...",
133-
"expiresIn": 604800
134-
}
142+
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
143+
},
144+
"meta": {
145+
"timestamp": "2025-09-06T16:19:56.197Z",
146+
"requestId": "1b53d9d6-ca2e-4b99-959b-8459820475b4",
147+
"version": "0.3.0"
135148
}
136149
}
137150
```
138151

139152
**cURL Example**:
140153

141154
```bash
142-
curl -X POST https://api.altus4.dev/api/v1/auth/login \
155+
curl -X POST http://localhost:3000/api/v1/auth/login \
143156
-H "Content-Type: application/json" \
144157
-d '{
145158
"email": "user@example.com",
@@ -166,22 +179,29 @@ Authorization: Bearer <JWT_TOKEN_FROM_LOGIN>
166179
"success": true,
167180
"data": {
168181
"apiKey": {
169-
"id": "key_abc123",
170-
"key": "altus4_sk_live_abc123def456...",
171-
"name": "My First API Key",
172-
"tier": "free",
173-
"permissions": ["search", "database:read"],
174-
"environment": "live",
175-
"createdAt": "2024-01-15T10:30:00.000Z"
176-
}
182+
"id": "9c81d4cf-fff8-48d0-994a-adc07e56bff3",
183+
"name": "Initial API Key",
184+
"keyPrefix": "altus4_sk_test_8wEp0HQVYpT6POU",
185+
"environment": "test",
186+
"permissions": ["search", "analytics"],
187+
"rateLimitTier": "free",
188+
"createdAt": "2025-09-06T16:20:01.401Z"
189+
},
190+
"secretKey": "altus4_sk_test_8wEp0HQVYpT6POUumHNuFdvK9gMw3y2Wa9a_BjVoOJw",
191+
"warning": "This is the only time the full API key will be shown. Please store it securely."
192+
},
193+
"meta": {
194+
"timestamp": "2025-09-06T16:20:01.403Z",
195+
"requestId": "fb62455b-8ccd-4cbb-898a-606ba936e25c",
196+
"version": "0.3.0"
177197
}
178198
}
179199
```
180200

181201
**cURL Example**:
182202

183203
```bash
184-
curl -X POST https://api.altus4.dev/api/v1/management/setup \
204+
curl -X POST http://localhost:3000/api/v1/management/setup \
185205
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
186206
```
187207

@@ -198,7 +218,7 @@ Create additional API keys for different environments or use cases.
198218
**Headers**:
199219

200220
```http
201-
Authorization: Bearer <YOUR_API_KEY>
221+
Authorization: Bearer <YOUR_JWT_TOKEN>
202222
Content-Type: application/json
203223
```
204224

@@ -245,7 +265,7 @@ Retrieve all API keys associated with your account.
245265
**Headers**:
246266

247267
```http
248-
Authorization: Bearer <YOUR_API_KEY>
268+
Authorization: Bearer <YOUR_JWT_TOKEN>
249269
```
250270

251271
**Response**:
@@ -280,7 +300,7 @@ Update an existing API key's name, tier, or permissions.
280300
**Headers**:
281301

282302
```http
283-
Authorization: Bearer <YOUR_API_KEY>
303+
Authorization: Bearer <YOUR_JWT_TOKEN>
284304
Content-Type: application/json
285305
```
286306

@@ -303,7 +323,7 @@ Permanently revoke an API key. This action cannot be undone.
303323
**Headers**:
304324

305325
```http
306-
Authorization: Bearer <YOUR_API_KEY>
326+
Authorization: Bearer <YOUR_JWT_TOKEN>
307327
```
308328

309329
**Response**:
@@ -327,7 +347,7 @@ Generate a new secret for an existing API key while maintaining the same ID and
327347
**Headers**:
328348

329349
```http
330-
Authorization: Bearer <YOUR_API_KEY>
350+
Authorization: Bearer <YOUR_JWT_TOKEN>
331351
```
332352

333353
**Response**:
@@ -361,7 +381,7 @@ Get detailed usage statistics for a specific API key.
361381
**Headers**:
362382

363383
```http
364-
Authorization: Bearer <YOUR_API_KEY>
384+
Authorization: Bearer <YOUR_JWT_TOKEN>
365385
```
366386

367387
**Response**:
@@ -408,7 +428,7 @@ Authorization: Bearer altus4_sk_live_abc123def456...
408428
```javascript
409429
const apiKey = 'altus4_sk_live_abc123def456...';
410430

411-
const response = await fetch('https://api.altus4.dev/api/v1/search', {
431+
const response = await fetch('http://localhost:3000/api/v1/search', {
412432
method: 'POST',
413433
headers: {
414434
Authorization: `Bearer ${apiKey}`,
@@ -432,7 +452,7 @@ import requests
432452
api_key = 'altus4_sk_live_abc123def456...'
433453

434454
response = requests.post(
435-
'https://api.altus4.dev/api/v1/search',
455+
'http://localhost:3000/api/v1/search',
436456
headers={
437457
'Authorization': f'Bearer {api_key}',
438458
'Content-Type': 'application/json'
@@ -559,7 +579,7 @@ const makeApiRequest = async (endpoint, data) => {
559579
Test your API key with a simple health check:
560580

561581
```bash
562-
curl -X GET https://api.altus4.dev/health \
582+
curl -X GET http://localhost:3000/health \
563583
-H "Authorization: Bearer altus4_sk_live_abc123..."
564584
```
565585

0 commit comments

Comments
 (0)