@minded-ai/mindedjs 3.1.31 → 3.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/agent.d.ts +3 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +20 -0
  4. package/dist/agent.js.map +1 -1
  5. package/dist/index.d.ts +4 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/platform/mindedConnectionTypes.d.ts +152 -0
  10. package/dist/platform/mindedConnectionTypes.d.ts.map +1 -1
  11. package/dist/platform/mindedConnectionTypes.js +4 -0
  12. package/dist/platform/mindedConnectionTypes.js.map +1 -1
  13. package/dist/toolsLibrary/knowledgeBase.d.ts +123 -0
  14. package/dist/toolsLibrary/knowledgeBase.d.ts.map +1 -0
  15. package/dist/toolsLibrary/knowledgeBase.js +180 -0
  16. package/dist/toolsLibrary/knowledgeBase.js.map +1 -0
  17. package/dist/utils/rag.d.ts +16 -0
  18. package/dist/utils/rag.d.ts.map +1 -0
  19. package/dist/utils/rag.js +206 -0
  20. package/dist/utils/rag.js.map +1 -0
  21. package/docs/SUMMARY.md +8 -2
  22. package/docs/api/analytics.md +132 -0
  23. package/docs/api/knowledge.md +460 -0
  24. package/docs/api/overview.md +78 -0
  25. package/docs/platform/knowledge-bases.md +191 -0
  26. package/docs/platform/security-architecture.md +0 -1
  27. package/docs/sdk/agent-api.md +12 -0
  28. package/docs/sdk/events.md +77 -24
  29. package/docs/sdk/knowledge-base-rag.md +211 -0
  30. package/docs/sdk/vectorstore-query.md +2 -0
  31. package/package.json +1 -1
  32. package/src/agent.ts +33 -2
  33. package/src/index.ts +21 -1
  34. package/src/platform/mindedConnectionTypes.ts +162 -0
  35. package/src/toolsLibrary/knowledgeBase.ts +217 -0
  36. package/src/utils/rag.ts +252 -0
  37. package/docs/platform/api.md +0 -258
@@ -0,0 +1,132 @@
1
+ # Analytics API
2
+
3
+ Query agent analytics events for dashboards, BI tools, and audits.
4
+
5
+ **Required scope**: `analytics`
6
+
7
+ ## Endpoints
8
+
9
+ | Method | Endpoint | Description |
10
+ | ------ | --------------- | -------------------------------- |
11
+ | GET | `/agents/list` | List agents in your organization |
12
+ | POST | `/events/agent` | Query agent analytics events |
13
+
14
+ ---
15
+
16
+ ## List Agents
17
+
18
+ ```http
19
+ GET /agents/list
20
+ ```
21
+
22
+ Returns all agents belonging to your organization.
23
+
24
+ ### Response
25
+
26
+ ```json
27
+ {
28
+ "success": true,
29
+ "data": [
30
+ {
31
+ "agentId": "agent-uuid-1",
32
+ "displayName": "My Support Agent",
33
+ "createdAt": "2025-10-01T10:30:00.000Z"
34
+ }
35
+ ],
36
+ "count": 1
37
+ }
38
+ ```
39
+
40
+ ### Response Fields
41
+
42
+ | Field | Type | Description |
43
+ | ------------------- | ------ | -------------------------------- |
44
+ | `data[].agentId` | string | Unique agent identifier |
45
+ | `data[].displayName`| string | Human-readable agent name |
46
+ | `data[].createdAt` | string | ISO 8601 creation timestamp |
47
+ | `count` | number | Total number of agents returned |
48
+
49
+ ---
50
+
51
+ ## Query Agent Events
52
+
53
+ ```http
54
+ POST /events/agent
55
+ ```
56
+
57
+ Query analytics events for a specific agent.
58
+
59
+ ### Request Body
60
+
61
+ | Field | Type | Required | Description |
62
+ | --------------------- | ------ | -------- | ------------------------------------------------------------- |
63
+ | `agentId` | string | Yes | Agent UUID (must belong to your organization) |
64
+ | `filters.environment` | string | No | `development`, `staging`, or `production`. Default: `production` |
65
+ | `filters.sessionId` | string | No | Filter by specific session UUID |
66
+ | `filters.eventName` | string | No | Filter by event type |
67
+ | `filters.startDate` | string | No | Start date (ISO 8601) |
68
+ | `filters.endDate` | string | No | End date (ISO 8601) |
69
+ | `limit` | number | No | Records per page (1–1000). Default: 100 |
70
+ | `offset` | number | No | Records to skip. Default: 0 |
71
+
72
+ ### Request Example
73
+
74
+ ```json
75
+ {
76
+ "agentId": "your-agent-id",
77
+ "filters": {
78
+ "environment": "production",
79
+ "startDate": "2025-10-01T00:00:00Z",
80
+ "endDate": "2025-10-31T23:59:59Z"
81
+ },
82
+ "limit": 100,
83
+ "offset": 0
84
+ }
85
+ ```
86
+
87
+ ### Response
88
+
89
+ ```json
90
+ {
91
+ "success": true,
92
+ "data": [
93
+ {
94
+ "id": 1,
95
+ "agentId": "your-agent-id",
96
+ "sessionId": "session-uuid",
97
+ "environment": "production",
98
+ "eventName": "invocation_start",
99
+ "payload": { ... },
100
+ "created_at": "2025-10-14T08:37:44.000Z"
101
+ }
102
+ ],
103
+ "count": 1,
104
+ "limit": 100,
105
+ "offset": 0
106
+ }
107
+ ```
108
+
109
+ ### Response Fields
110
+
111
+ | Field | Type | Description |
112
+ | ------------------ | ------ | ----------------------------------------- |
113
+ | `data[].id` | number | Event record ID |
114
+ | `data[].agentId` | string | Agent UUID |
115
+ | `data[].sessionId` | string | Session UUID |
116
+ | `data[].environment` | string | Environment where event occurred |
117
+ | `data[].eventName` | string | Event type |
118
+ | `data[].payload` | object | Event-specific data |
119
+ | `data[].created_at`| string | ISO 8601 timestamp when event was recorded|
120
+ | `count` | number | Number of events in current page |
121
+ | `limit` | number | Page size used |
122
+ | `offset` | number | Offset used |
123
+
124
+ ## Event Types
125
+
126
+ The SDK automatically tracks built-in events. You can also emit custom events.
127
+
128
+ **Built-in events**: `invocation_start`, `invocation_error`, `node_execution`, and more.
129
+
130
+ **Custom events**: Use `trackAnalyticsEvent()` from your agent code.
131
+
132
+ See [SDK Events - ANALYTICS_EVENT](../sdk/events.md#analytics_event) for details.
@@ -0,0 +1,460 @@
1
+ # Knowledge API
2
+
3
+ Manage documents within knowledge bases programmatically. Upload, update, retrieve metadata, and delete documents.
4
+
5
+ **Required scope**: `knowledge-management`
6
+
7
+ > **Prerequisite**: Knowledge bases are created in the platform dashboard. See [Knowledge Bases](../platform/knowledge-bases.md). This API manages documents within existing knowledge bases.
8
+
9
+ ## Document Upload Flow
10
+
11
+ Uploading a document requires three steps:
12
+
13
+ ```
14
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
15
+ │ 1. Request │ │ 2. Upload │ │ 3. Complete │ │ 4. Poll │
16
+ │ Upload Link │────▶│ File to S3 │────▶│ Upload │────▶│ Status │
17
+ └─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
18
+ │ │ │ │
19
+ ▼ ▼ ▼ ▼
20
+ POST /upload-link PUT to uploadUrl POST /upload-complete GET /documents
21
+ Returns: uploadUrl, Include headers Returns: status Check status
22
+ uploadId, s3Key from response "pending" until "ready"
23
+ ```
24
+
25
+ 1. **Request upload link** — Call `/knowledge/documents/upload-link` to get a pre-signed S3 URL
26
+ 2. **Upload file** — PUT the file bytes to the returned `uploadUrl` with `requiredHeaders`
27
+ 3. **Complete upload** — Call `/knowledge/documents/upload-complete` with the `uploadId`
28
+ 4. **Poll status** — Query `/knowledge/documents` until `status` becomes `ready` or `failed`
29
+
30
+ ## Document Status Values
31
+
32
+ | Status | Description |
33
+ | ----------- | -------------------------------------------------------------- |
34
+ | `pending` | Document uploaded, processing not yet started |
35
+ | `processing`| Document is being processed (text extraction, chunking, embedding) |
36
+ | `ready` | Document processed successfully and available for retrieval |
37
+ | `failed` | Processing failed; check error details |
38
+
39
+ ## Document Identifiers
40
+
41
+ Documents can be referenced using two identifiers:
42
+
43
+ | Identifier | Description |
44
+ | ------------------ | ----------------------------------------------------------------------------------------------- |
45
+ | `s3Key` | System-generated path in format `agents/<agentId>/<env>/<kbId>/<filename>`. Returned by upload endpoints. |
46
+ | `customDocumentId` | Optional user-defined identifier. Use this to map documents to your external system IDs (e.g., CRM record ID, ticket ID). When provided during upload, you can use it instead of `s3Key` for update and delete operations. |
47
+
48
+ ## Custom Metadata
49
+
50
+ The `metadata` field accepts arbitrary key-value pairs that you define. This is your custom metadata for filtering and organizing documents—not a predefined schema.
51
+
52
+ ```json
53
+ {
54
+ "metadata": {
55
+ "category": "policy",
56
+ "locale": "en-US",
57
+ "version": "2.1",
58
+ "department": "support"
59
+ }
60
+ }
61
+ ```
62
+
63
+ Use metadata to filter documents during retrieval (see [Knowledge Base RAG API](../sdk/knowledge-base-rag.md)).
64
+
65
+ ---
66
+
67
+ ## Endpoints
68
+
69
+ | Method | Endpoint | Description |
70
+ | ------ | ------------------------------------- | ---------------------------------- |
71
+ | POST | `/knowledge/documents/upload-link` | Get pre-signed URL for new document|
72
+ | POST | `/knowledge/documents/upload-complete`| Finalize new document upload |
73
+ | POST | `/knowledge/documents/update/upload-link` | Get pre-signed URL to update document |
74
+ | POST | `/knowledge/documents/update/upload-complete` | Finalize document update |
75
+ | PATCH | `/knowledge/documents/metadata` | Update document metadata only |
76
+ | GET | `/knowledge/documents` | Get document metadata |
77
+ | DELETE | `/knowledge/documents` | Delete a document |
78
+
79
+ ---
80
+
81
+ ## Create Upload Link
82
+
83
+ ```http
84
+ POST /knowledge/documents/upload-link
85
+ ```
86
+
87
+ Generate a pre-signed URL to upload a new document.
88
+
89
+ ### Request Body
90
+
91
+ | Field | Type | Required | Description |
92
+ | ------------------ | ------ | -------- | --------------------------------------------------------------- |
93
+ | `agentId` | string | Yes | Agent UUID |
94
+ | `environment` | string | Yes | `development`, `staging`, or `production` |
95
+ | `knowledgeBaseId` | string | Yes | Knowledge base UUID |
96
+ | `fileName` | string | Yes | File name with extension (e.g., `policy.pdf`). If `.zip`, triggers batch import. |
97
+ | `name` | string | No | Display name for the document |
98
+ | `metadata` | object | No | Custom key-value pairs for filtering |
99
+ | `customDocumentId` | string | No | Your external identifier for this document |
100
+
101
+ ### Request Example
102
+
103
+ ```json
104
+ {
105
+ "agentId": "your-agent-id",
106
+ "environment": "production",
107
+ "knowledgeBaseId": "kb-abc123",
108
+ "fileName": "refund-policy.pdf",
109
+ "name": "Refund Policy",
110
+ "metadata": {
111
+ "category": "policy",
112
+ "locale": "en"
113
+ },
114
+ "customDocumentId": "DOC-12345"
115
+ }
116
+ ```
117
+
118
+ ### Response
119
+
120
+ ```json
121
+ {
122
+ "uploadId": "upload-uuid",
123
+ "uploadUrl": "https://s3.amazonaws.com/...",
124
+ "expiresIn": 3600,
125
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
126
+ "documentId": "document-uuid",
127
+ "requiredHeaders": {
128
+ "Content-Type": "application/pdf"
129
+ }
130
+ }
131
+ ```
132
+
133
+ ### Response Fields
134
+
135
+ | Field | Type | Description |
136
+ | ----------------- | ------ | -------------------------------------------------------- |
137
+ | `uploadId` | string | Unique identifier for this upload session |
138
+ | `uploadUrl` | string | Pre-signed S3 URL for file upload (expires per `expiresIn`) |
139
+ | `expiresIn` | number | Seconds until `uploadUrl` expires |
140
+ | `s3Key` | string | Document path in storage; use for subsequent operations |
141
+ | `documentId` | string | System-generated document UUID |
142
+ | `requiredHeaders` | object | Headers to include when uploading to `uploadUrl` |
143
+
144
+ ### Uploading the File
145
+
146
+ After receiving the response, upload your file:
147
+
148
+ ```bash
149
+ curl -X PUT "<uploadUrl>" \
150
+ -H "Content-Type: application/pdf" \
151
+ --data-binary @refund-policy.pdf
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Complete Upload
157
+
158
+ ```http
159
+ POST /knowledge/documents/upload-complete
160
+ ```
161
+
162
+ Finalize the upload and trigger document processing.
163
+
164
+ ### Request Body
165
+
166
+ | Field | Type | Required | Description |
167
+ | ---------- | ------ | -------- | --------------------- |
168
+ | `uploadId` | string | Yes | The `uploadId` from upload-link response |
169
+
170
+ ### Request Example
171
+
172
+ ```json
173
+ {
174
+ "uploadId": "upload-uuid"
175
+ }
176
+ ```
177
+
178
+ ### Response (Document)
179
+
180
+ ```json
181
+ {
182
+ "type": "document",
183
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
184
+ "documentId": "document-uuid",
185
+ "name": "Refund Policy",
186
+ "createdAt": "2026-01-15T12:00:00.000Z",
187
+ "updatedAt": "2026-01-15T12:00:00.000Z",
188
+ "status": "pending"
189
+ }
190
+ ```
191
+
192
+ ### Response (ZIP Import)
193
+
194
+ When `fileName` ends with `.zip`, the response indicates a batch import job:
195
+
196
+ ```json
197
+ {
198
+ "type": "zip_import",
199
+ "zipJobId": "job-uuid",
200
+ "status": "Pending",
201
+ "s3Key": "agents/agent-id/production/kb-abc123/archive.zip"
202
+ }
203
+ ```
204
+
205
+ ### Response Fields
206
+
207
+ | Field | Type | Description |
208
+ | ------------ | ------ | ----------------------------------------------------- |
209
+ | `type` | string | `document` for single files, `zip_import` for archives|
210
+ | `s3Key` | string | Document path in storage |
211
+ | `documentId` | string | Document UUID (for `document` type) |
212
+ | `zipJobId` | string | Import job UUID (for `zip_import` type) |
213
+ | `name` | string | Document display name |
214
+ | `status` | string | Processing status (see [Status Values](#document-status-values)) |
215
+ | `createdAt` | string | ISO 8601 creation timestamp |
216
+ | `updatedAt` | string | ISO 8601 last update timestamp |
217
+
218
+ ---
219
+
220
+ ## Create Update Upload Link
221
+
222
+ ```http
223
+ POST /knowledge/documents/update/upload-link
224
+ ```
225
+
226
+ Generate a pre-signed URL to replace an existing document's content.
227
+
228
+ ### Request Body
229
+
230
+ | Field | Type | Required | Description |
231
+ | ------------------ | ------ | -------- | --------------------------------------------------------------- |
232
+ | `agentId` | string | Yes | Agent UUID |
233
+ | `environment` | string | Yes | `development`, `staging`, or `production` |
234
+ | `knowledgeBaseId` | string | Yes | Knowledge base UUID |
235
+ | `s3Key` | string | * | Document path to update. Required if `customDocumentId` not provided. |
236
+ | `customDocumentId` | string | * | Your external document ID. Required if `s3Key` not provided. |
237
+ | `fileName` | string | Yes | New file name |
238
+ | `metadata` | object | No | Updated custom metadata (replaces existing) |
239
+
240
+ > **Note**: Provide either `s3Key` or `customDocumentId`, not both.
241
+
242
+ ### Request Example
243
+
244
+ ```json
245
+ {
246
+ "agentId": "your-agent-id",
247
+ "environment": "production",
248
+ "knowledgeBaseId": "kb-abc123",
249
+ "customDocumentId": "DOC-12345",
250
+ "fileName": "refund-policy-v2.pdf",
251
+ "metadata": {
252
+ "category": "policy",
253
+ "locale": "en",
254
+ "version": "2.0"
255
+ }
256
+ }
257
+ ```
258
+
259
+ ### Response
260
+
261
+ ```json
262
+ {
263
+ "uploadId": "upload-uuid",
264
+ "uploadUrl": "https://s3.amazonaws.com/...",
265
+ "expiresIn": 3600,
266
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy-v2.pdf",
267
+ "requiredHeaders": {
268
+ "Content-Type": "application/pdf"
269
+ }
270
+ }
271
+ ```
272
+
273
+ ---
274
+
275
+ ## Complete Update Upload
276
+
277
+ ```http
278
+ POST /knowledge/documents/update/upload-complete
279
+ ```
280
+
281
+ Finalize document update and trigger reprocessing.
282
+
283
+ ### Request Body
284
+
285
+ | Field | Type | Required | Description |
286
+ | ---------- | ------ | -------- | --------------------- |
287
+ | `uploadId` | string | Yes | The `uploadId` from update/upload-link response |
288
+
289
+ ### Request Example
290
+
291
+ ```json
292
+ {
293
+ "uploadId": "upload-uuid"
294
+ }
295
+ ```
296
+
297
+ ### Response
298
+
299
+ ```json
300
+ {
301
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy-v2.pdf",
302
+ "documentId": "document-uuid",
303
+ "name": "Refund Policy",
304
+ "updatedAt": "2026-01-16T12:00:00.000Z",
305
+ "status": "pending"
306
+ }
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Update Metadata
312
+
313
+ ```http
314
+ PATCH /knowledge/documents/metadata
315
+ ```
316
+
317
+ Update document display name and/or metadata without re-uploading the file.
318
+
319
+ ### Request Body
320
+
321
+ | Field | Type | Required | Description |
322
+ | ------------------ | ------ | -------- | --------------------------------------------------------------- |
323
+ | `agentId` | string | Yes | Agent UUID |
324
+ | `environment` | string | Yes | `development`, `staging`, or `production` |
325
+ | `knowledgeBaseId` | string | Yes | Knowledge base UUID |
326
+ | `s3Key` | string | * | Document path. Required if `customDocumentId` not provided. |
327
+ | `customDocumentId` | string | * | Your external document ID. Required if `s3Key` not provided. |
328
+ | `name` | string | No | New display name |
329
+ | `metadata` | object | No | New custom metadata (replaces existing) |
330
+
331
+ ### Request Example
332
+
333
+ ```json
334
+ {
335
+ "agentId": "your-agent-id",
336
+ "environment": "production",
337
+ "knowledgeBaseId": "kb-abc123",
338
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
339
+ "name": "Refund Policy (Updated)",
340
+ "metadata": {
341
+ "category": "policy",
342
+ "locale": "en",
343
+ "reviewed": "true"
344
+ }
345
+ }
346
+ ```
347
+
348
+ ### Response
349
+
350
+ ```json
351
+ {
352
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
353
+ "documentId": "document-uuid",
354
+ "name": "Refund Policy (Updated)",
355
+ "metadata": {
356
+ "category": "policy",
357
+ "locale": "en",
358
+ "reviewed": "true"
359
+ },
360
+ "updatedAt": "2026-01-16T14:00:00.000Z"
361
+ }
362
+ ```
363
+
364
+ ---
365
+
366
+ ## Get Document
367
+
368
+ ```http
369
+ GET /knowledge/documents
370
+ ```
371
+
372
+ Retrieve metadata for a specific document.
373
+
374
+ ### Query Parameters
375
+
376
+ | Parameter | Type | Required | Description |
377
+ | ------------------ | ------ | -------- | --------------------------------------------------------------- |
378
+ | `agentId` | string | Yes | Agent UUID |
379
+ | `environment` | string | Yes | `development`, `staging`, or `production` |
380
+ | `knowledgeBaseId` | string | Yes | Knowledge base UUID |
381
+ | `s3Key` | string | * | Document path. Required if `customDocumentId` not provided. |
382
+ | `customDocumentId` | string | * | Your external document ID. Required if `s3Key` not provided. |
383
+
384
+ ### Request Example
385
+
386
+ ```
387
+ GET /knowledge/documents?agentId=your-agent-id&environment=production&knowledgeBaseId=kb-abc123&s3Key=agents/agent-id/production/kb-abc123/refund-policy.pdf
388
+ ```
389
+
390
+ ### Response
391
+
392
+ ```json
393
+ {
394
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
395
+ "documentId": "document-uuid",
396
+ "customDocumentId": "DOC-12345",
397
+ "name": "Refund Policy",
398
+ "status": "ready",
399
+ "metadata": {
400
+ "category": "policy",
401
+ "locale": "en"
402
+ },
403
+ "createdAt": "2026-01-15T12:00:00.000Z",
404
+ "updatedAt": "2026-01-16T14:00:00.000Z"
405
+ }
406
+ ```
407
+
408
+ ### Response Fields
409
+
410
+ | Field | Type | Description |
411
+ | ------------------ | ------ | -------------------------------------------------------- |
412
+ | `s3Key` | string | Document path in storage |
413
+ | `documentId` | string | System-generated document UUID |
414
+ | `customDocumentId` | string | Your external document ID (if provided during upload) |
415
+ | `name` | string | Document display name |
416
+ | `status` | string | Processing status (see [Status Values](#document-status-values)) |
417
+ | `metadata` | object | Custom key-value pairs |
418
+ | `createdAt` | string | ISO 8601 creation timestamp |
419
+ | `updatedAt` | string | ISO 8601 last update timestamp |
420
+
421
+ ---
422
+
423
+ ## Delete Document
424
+
425
+ ```http
426
+ DELETE /knowledge/documents
427
+ ```
428
+
429
+ Remove a document from the knowledge base.
430
+
431
+ ### Request Body
432
+
433
+ | Field | Type | Required | Description |
434
+ | ------------------ | ------ | -------- | --------------------------------------------------------------- |
435
+ | `agentId` | string | Yes | Agent UUID |
436
+ | `environment` | string | Yes | `development`, `staging`, or `production` |
437
+ | `knowledgeBaseId` | string | Yes | Knowledge base UUID |
438
+ | `s3Key` | string | * | Document path. Required if `customDocumentId` not provided. |
439
+ | `customDocumentId` | string | * | Your external document ID. Required if `s3Key` not provided. |
440
+
441
+ ### Request Example
442
+
443
+ ```json
444
+ {
445
+ "agentId": "your-agent-id",
446
+ "environment": "production",
447
+ "knowledgeBaseId": "kb-abc123",
448
+ "customDocumentId": "DOC-12345"
449
+ }
450
+ ```
451
+
452
+ ### Response
453
+
454
+ ```json
455
+ {
456
+ "success": true,
457
+ "s3Key": "agents/agent-id/production/kb-abc123/refund-policy.pdf",
458
+ "documentId": "document-uuid"
459
+ }
460
+ ```
@@ -0,0 +1,78 @@
1
+ # REST API Overview
2
+
3
+ The Minded REST API provides programmatic access to analytics events and knowledge base document management.
4
+
5
+ ## Base URL
6
+
7
+ ```
8
+ https://api.minded.com/api/v1
9
+ ```
10
+
11
+ ## Authentication
12
+
13
+ All API requests require an **organization API token** passed via the `Authorization` header:
14
+
15
+ ```http
16
+ Authorization: Bearer md_yourTokenHere
17
+ ```
18
+
19
+ ### Token Characteristics
20
+
21
+ - **Scoped**: Permissions are granted per token
22
+ - **Org-bound**: Requests are authorized for the organization tied to the token
23
+ - **One-time visible**: The plaintext token is shown only when created and cannot be recovered
24
+
25
+ ### Managing Tokens
26
+
27
+ In the Minded dashboard, navigate to **Organization Settings → API Tokens** to create, view, or revoke tokens.
28
+
29
+ ### Token Scopes
30
+
31
+ | Scope | Grants Access To |
32
+ | ---------------------- | -------------------------- |
33
+ | `analytics` | [Analytics API](analytics.md) |
34
+ | `knowledge-management` | [Knowledge API](knowledge.md) |
35
+
36
+ ## Rate Limiting
37
+
38
+ Rate limits vary by deployment (default: ~10 requests/minute). Response headers indicate current limits:
39
+
40
+ | Header | Description |
41
+ | ----------------------- | ------------------------------ |
42
+ | `RateLimit-Limit` | Maximum requests allowed |
43
+ | `RateLimit-Remaining` | Requests remaining in window |
44
+ | `RateLimit-Reset` | Seconds until limit resets |
45
+
46
+ ## Response Format
47
+
48
+ All responses are JSON. Successful responses typically include:
49
+
50
+ ```json
51
+ {
52
+ "success": true,
53
+ "data": { ... }
54
+ }
55
+ ```
56
+
57
+ ## Error Codes
58
+
59
+ | Code | Description |
60
+ | ---- | ------------------------------------------------------------ |
61
+ | 400 | Bad request — missing required fields or invalid parameters |
62
+ | 401 | Unauthorized — invalid or missing token |
63
+ | 403 | Forbidden — token missing required scope |
64
+ | 404 | Not found — resource does not exist or does not belong to your organization |
65
+ | 429 | Too many requests — rate limit exceeded |
66
+ | 500 | Internal server error |
67
+
68
+ Error responses include details:
69
+
70
+ ```json
71
+ {
72
+ "success": false,
73
+ "error": {
74
+ "code": "VALIDATION_ERROR",
75
+ "message": "Missing required field: agentId"
76
+ }
77
+ }
78
+ ```