-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
938 lines (905 loc) · 26.3 KB
/
openapi.yaml
File metadata and controls
938 lines (905 loc) · 26.3 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
openapi: 3.1.0
info:
title: MindSpring
version: 0.4.0
description: |
Semantic search engine for AI conversation exports.
Deployed on Cloudflare Workers with Vectorize, R2, Workers AI, and KV.
license:
name: MIT
url: https://github.com/Stackbilt-dev/mindspring/blob/main/LICENSE
servers:
- url: https://mindspring.example.com
description: Production (replace with your Worker URL)
security:
- bearerAuth: []
- apiKeyHeader: []
paths:
/:
get:
summary: Service info
operationId: getRoot
security: []
tags: [system]
responses:
'200':
description: Service metadata and endpoint listing
content:
application/json:
schema:
type: object
properties:
name:
type: string
example: MindSpring
version:
type: string
example: 0.3.0
description:
type: string
auth:
type: string
docs:
type: string
format: uri
endpoints:
type: object
additionalProperties:
type: string
/api/chat:
post:
summary: RAG chat
operationId: chatWithHistory
tags: [chat]
x-auth-scope: read
description: |
Ask questions about your conversation history. Retrieves relevant
conversations via semantic search, then generates a synthesized
answer using DeepSeek R1 reasoning model.
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [question]
properties:
question:
type: string
maxLength: 2000
description: The question to ask about your conversation history
example: What recurring themes appear across my conversations?
history:
type: array
description: Previous chat messages for multi-turn context
items:
type: object
required: [role, content]
properties:
role:
type: string
enum: [user, assistant]
content:
type: string
responses:
'200':
description: Generated answer with source citations
content:
application/json:
schema:
type: object
properties:
answer:
type: string
description: Synthesized response from the reasoning model
sources:
type: array
items:
type: object
properties:
id:
type: string
title:
type: string
score:
type: number
format: float
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/api/search:
get:
summary: Semantic search
operationId: searchConversations
tags: [search]
x-auth-scope: read
parameters:
- name: q
in: query
required: true
description: Search query text
schema:
type: string
maxLength: 2000
- name: limit
in: query
schema:
type: integer
default: 10
minimum: 1
maximum: 100
- name: threshold
in: query
description: Minimum similarity score
schema:
type: number
format: float
default: 0.3
minimum: 0
maximum: 1
responses:
'200':
description: Search results ranked by semantic similarity
content:
application/json:
schema:
type: object
required: [query, count, results]
properties:
query:
type: string
count:
type: integer
results:
type: array
items:
$ref: '#/components/schemas/SearchResult'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'429':
$ref: '#/components/responses/RateLimited'
/api/conversations:
get:
summary: Browse conversations
operationId: listConversations
tags: [conversations]
x-auth-scope: read
parameters:
- name: limit
in: query
schema:
type: integer
default: 20
minimum: 1
maximum: 100
- name: cursor
in: query
description: Pagination cursor from previous response
schema:
type: string
responses:
'200':
description: Paginated conversation list
content:
application/json:
schema:
type: object
required: [conversations]
properties:
conversations:
type: array
items:
$ref: '#/components/schemas/ConversationSummary'
next_cursor:
type: string
nullable: true
'401':
$ref: '#/components/responses/Unauthorized'
/api/conversations/{id}:
get:
summary: Get conversation
operationId: getConversation
tags: [conversations]
x-auth-scope: read
parameters:
- $ref: '#/components/parameters/ConversationId'
responses:
'200':
description: Full conversation record
content:
application/json:
schema:
$ref: '#/components/schemas/ConversationRecord'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/api/conversations/{id}/similar:
get:
summary: Find similar conversations
operationId: findSimilar
tags: [conversations]
x-auth-scope: read
parameters:
- $ref: '#/components/parameters/ConversationId'
- name: limit
in: query
schema:
type: integer
default: 5
minimum: 1
maximum: 20
responses:
'200':
description: Similar conversations ranked by similarity
content:
application/json:
schema:
type: object
required: [results]
properties:
results:
type: array
items:
$ref: '#/components/schemas/SearchResult'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/api/uploads/simple:
post:
summary: Upload conversation file (small)
operationId: simpleUpload
description: Direct upload for files under 5MB. Send the raw JSON as the request body.
tags: [uploads]
x-auth-scope: ingest
parameters:
- name: X-File-Name
in: header
description: Original file name
schema:
type: string
default: conversations.json
requestBody:
required: true
content:
application/json:
schema:
description: Raw conversation export JSON (array or object)
responses:
'202':
description: Upload accepted, ingestion queued
content:
application/json:
schema:
$ref: '#/components/schemas/UploadAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'413':
description: File too large — use multipart upload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'415':
description: Invalid content type
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'429':
$ref: '#/components/responses/RateLimited'
/api/uploads:
post:
summary: Initiate multipart upload
operationId: createMultipartUpload
description: Start a multipart upload session for large files. Returns an uploadId and R2 multipart upload ID.
tags: [uploads]
x-auth-scope: ingest
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [fileName]
properties:
fileName:
type: string
example: conversations.json
fileSize:
type: integer
description: File size in bytes
responses:
'200':
description: Multipart upload session created
content:
application/json:
schema:
type: object
required: [uploadId, r2Key, multipartUploadId]
properties:
uploadId:
type: string
format: uuid
r2Key:
type: string
multipartUploadId:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
/api/uploads/{id}/part:
post:
summary: Upload a part
operationId: uploadPart
tags: [uploads]
x-auth-scope: ingest
parameters:
- $ref: '#/components/parameters/UploadId'
- name: partNumber
in: query
required: true
schema:
type: integer
minimum: 1
- name: multipartUploadId
in: query
required: true
schema:
type: string
requestBody:
required: true
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Part uploaded
content:
application/json:
schema:
type: object
required: [partNumber, etag]
properties:
partNumber:
type: integer
etag:
type: string
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/api/uploads/{id}/complete:
post:
summary: Complete multipart upload
operationId: completeUpload
description: Finalize the upload and enqueue ingestion.
tags: [uploads]
x-auth-scope: ingest
parameters:
- $ref: '#/components/parameters/UploadId'
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [multipartUploadId, parts]
properties:
multipartUploadId:
type: string
parts:
type: array
items:
type: object
required: [partNumber, etag]
properties:
partNumber:
type: integer
etag:
type: string
responses:
'202':
description: Upload finalized, ingestion queued
content:
application/json:
schema:
$ref: '#/components/schemas/UploadAccepted'
'404':
$ref: '#/components/responses/NotFound'
/api/uploads/{id}/status:
get:
summary: Check ingestion progress
operationId: getUploadStatus
tags: [uploads]
x-auth-scope: ingest
parameters:
- $ref: '#/components/parameters/UploadId'
responses:
'200':
description: Current ingestion progress
content:
application/json:
schema:
$ref: '#/components/schemas/UploadProgress'
'404':
$ref: '#/components/responses/NotFound'
/api/stats:
get:
summary: Collection statistics
operationId: getStats
tags: [system]
x-auth-scope: read
responses:
'200':
description: Vectorize index statistics
content:
application/json:
schema:
type: object
properties:
description:
type: object
properties:
dimensions:
type: integer
example: 1024
vectorCount:
type: integer
'502':
description: Vectorize unavailable
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/health:
get:
summary: Health check
operationId: healthCheck
tags: [system]
x-auth-scope: read
responses:
'200':
description: All services healthy
content:
application/json:
schema:
$ref: '#/components/schemas/HealthStatus'
'503':
description: One or more services degraded
content:
application/json:
schema:
$ref: '#/components/schemas/HealthStatus'
/api/auth/keys:
post:
summary: Create API key
operationId: createApiKey
tags: [auth]
x-auth-scope: admin
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name, scope]
properties:
name:
type: string
description: Human-readable label
example: my-ingest-key
scope:
$ref: '#/components/schemas/ApiKeyScope'
responses:
'201':
description: API key created
content:
application/json:
schema:
type: object
required: [apiKey, name, scope, createdAt, warning]
properties:
apiKey:
type: string
description: The API key — store securely, cannot be retrieved later
name:
type: string
scope:
$ref: '#/components/schemas/ApiKeyScope'
createdAt:
type: string
format: date-time
warning:
type: string
'400':
$ref: '#/components/responses/BadRequest'
get:
summary: List API keys
operationId: listApiKeys
description: Returns metadata only — raw keys are never exposed.
tags: [auth]
x-auth-scope: admin
responses:
'200':
description: List of API key metadata
content:
application/json:
schema:
type: object
required: [keys]
properties:
keys:
type: array
items:
type: object
properties:
name:
type: string
scope:
$ref: '#/components/schemas/ApiKeyScope'
createdAt:
type: string
format: date-time
lastUsedAt:
type: string
format: date-time
nullable: true
revoked:
type: boolean
keyPrefix:
type: string
description: First 10 characters for identification
/api/auth/keys/{name}:
delete:
summary: Revoke API key
operationId: revokeApiKey
tags: [auth]
x-auth-scope: admin
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
'200':
description: Key revoked
content:
application/json:
schema:
type: object
properties:
revoked:
type: boolean
enum: [true]
name:
type: string
'404':
$ref: '#/components/responses/NotFound'
/api/telemetry:
get:
summary: Query flow logs
operationId: listTelemetry
tags: [telemetry]
x-auth-scope: admin
parameters:
- name: limit
in: query
schema:
type: integer
default: 50
minimum: 1
maximum: 200
- name: category
in: query
schema:
type: string
enum: [request, ingestion, error, auth]
- name: cursor
in: query
schema:
type: string
responses:
'200':
description: Telemetry events
content:
application/json:
schema:
type: object
required: [count, entries]
properties:
count:
type: integer
cursor:
type: string
nullable: true
entries:
type: array
items:
$ref: '#/components/schemas/TelemetryEnvelope'
/api/telemetry/{id}:
get:
summary: Get events for a request or upload
operationId: getTelemetryById
tags: [telemetry]
x-auth-scope: admin
parameters:
- name: id
in: path
required: true
description: Request ID or upload ID
schema:
type: string
responses:
'200':
description: Events for this ID
content:
application/json:
schema:
type: object
required: [requestId, count, entries]
properties:
requestId:
type: string
count:
type: integer
entries:
type: array
items:
$ref: '#/components/schemas/TelemetryEnvelope'
'404':
$ref: '#/components/responses/NotFound'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: 'API key as Bearer token: `Authorization: Bearer ms_...`'
apiKeyHeader:
type: apiKey
in: header
name: X-API-Key
description: 'API key via header: `X-API-Key: ms_...`'
parameters:
ConversationId:
name: id
in: path
required: true
description: Conversation ID
schema:
type: string
UploadId:
name: id
in: path
required: true
description: Upload session ID
schema:
type: string
format: uuid
schemas:
SearchResult:
type: object
required: [id, title, text, create_time, score]
properties:
id:
type: string
title:
type: string
text:
type: string
create_time:
type: number
description: Unix timestamp (seconds)
score:
type: number
format: float
description: Cosine similarity score (0-1)
ConversationSummary:
type: object
required: [id, title, text, create_time, source]
properties:
id:
type: string
title:
type: string
text:
type: string
description: First 500 characters
create_time:
type: number
source:
$ref: '#/components/schemas/ConversationSource'
ConversationRecord:
type: object
required: [id, title, text, create_time, update_time, source, upload_id]
properties:
id:
type: string
title:
type: string
text:
type: string
description: Full extracted conversation text
create_time:
type: number
update_time:
type: number
source:
$ref: '#/components/schemas/ConversationSource'
upload_id:
type: string
format: uuid
ConversationSource:
type: string
enum: [gpt, claude]
UploadAccepted:
type: object
required: [status, uploadId]
properties:
status:
type: string
enum: [processing]
uploadId:
type: string
format: uuid
UploadProgress:
type: object
required: [status, r2Key, fileName, fileSize, totalConversations, processedConversations, lastCheckpointIndex, createdAt, updatedAt]
properties:
status:
type: string
enum: [uploading, processing, completed, failed]
r2Key:
type: string
fileName:
type: string
fileSize:
type: integer
totalConversations:
type: integer
nullable: true
processedConversations:
type: integer
lastCheckpointIndex:
type: integer
errorMessage:
type: string
createdAt:
type: string
format: date-time
updatedAt:
type: string
format: date-time
ApiKeyScope:
type: string
enum: [admin, ingest, read]
description: 'Hierarchical: admin > ingest > read'
HealthStatus:
type: object
required: [status, checks]
properties:
status:
type: string
enum: [healthy, degraded]
checks:
type: object
properties:
vectorize:
type: string
enum: [ok, error]
ai:
type: string
enum: [ok, error]
TelemetryEnvelope:
type: object
required: [requestId, timestamp, service, category]
properties:
requestId:
type: string
timestamp:
type: string
format: date-time
service:
type: string
enum: [mindspring]
category:
type: string
enum: [request, ingestion, search, auth, error]
method:
type: string
path:
type: string
status:
type: integer
durationMs:
type: number
authKeyName:
type: string
data:
type: object
additionalProperties: true
error:
type: object
properties:
message:
type: string
stack:
type: string
Error:
type: object
required: [error]
properties:
error:
type: string
detail:
type: string
responses:
BadRequest:
description: Invalid request parameters
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Missing or invalid API key
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
RateLimited:
description: Rate limit exceeded
headers:
Retry-After:
schema:
type: integer
X-RateLimit-Limit:
schema:
type: integer
X-RateLimit-Remaining:
schema:
type: integer
X-RateLimit-Reset:
schema:
type: integer
content:
application/json:
schema:
type: object
properties:
error:
type: string
retryAfter:
type: integer
limit:
type: integer
window:
type: string
tags:
- name: chat
description: RAG chat — ask questions about your conversation history
- name: search
description: Semantic search across conversations
- name: conversations
description: Browse, read, and discover conversations
- name: uploads
description: Upload conversation exports and track ingestion
- name: auth
description: API key management (admin only)
- name: telemetry
description: Structured flow logs (admin only)
- name: system
description: Health checks and statistics