@@ -14,9 +14,10 @@ Altus 4 uses API key-based authentication for all service integration. This prov
1414### Authentication Flow
1515
16161 . ** 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
2223graph 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 >
202222Content-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 >
284304Content-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
409429const 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
432452api_key = ' altus4_sk_live_abc123def456...'
433453
434454response = 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) => {
559579Test 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