-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yml
More file actions
2395 lines (2314 loc) · 109 KB
/
Copy pathopenapi.yml
File metadata and controls
2395 lines (2314 loc) · 109 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
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
openapi: 3.1.0
info:
title: Pulse API
version: 0.10.0
description: |
A stateless RESTful service that provides **seven** core capabilities:
- Batch generation of dense vector embeddings for up to 200 input strings.
- Flexible cosine-similarity computations across strings.
- Thematic clustering of open-ended text into concise, human-readable themes.
- Sentiment classification of each input string.
- Extraction of text elements matching specified themes from input strings.
- Clustering of text into groups using vector embeddings.
- Data dictionary generation from 2D arrays with DDI Codebook output.
### Similarity
The similarity endpoint supports two scenarios:
1. **Self-similarity** - Provide a single set of strings (`set`) and the
service **always** returns a **flattened** upper-triangle similarity
vector (excluding the diagonal). The response also includes the number
of input strings (`n`) so the caller can easily re-shape the full matrix.
2. **Cross-similarity** - Provide two distinct sets (`set_a` and `set_b`)
and the service returns similarities only between items across the two
sets (|A| x |B| matrix). The representation can be `matrix` (default)
or flattened when the `flatten=true` query parameter is supplied.
### Themes
The themes endpoint groups a collection of open-ended responses (e.g., survey
comments, product reviews) into **latent themes**. Each theme now contains:
- `shortLabel` - a concise (2-4 word) name for dashboards or charts.
- `label` - a slightly longer descriptive title.
- `description` - 1-2 sentences summarizing the common idea captured by the theme.
- `representatives` - exactly two representative input strings for each theme.
Callers may optionally specify `minThemes`, `maxThemes`, and a free-text
`context` string to steer clustering (e.g., "focus on UX issues").
### Sentiment
The sentiment endpoint classifies each input string as **positive**, **negative**,
**neutral**, or **mixed** and returns a confidence value ∈ [0, 1].
### Data Dictionary
The data dictionary endpoint analyzes 2D arrays of data cells and generates comprehensive
DDI (Data Documentation Initiative) Codebook documentation in JSON format. It uses AI
to intelligently analyze data patterns, infer variable types, detect value ranges, and
generate meaningful metadata descriptions that conform to DDI standards. Only supports
asynchronous processing due to the computational complexity of analyzing large datasets.
### Versioning
The service maintains internally versioned models. When the optional `version`
field is omitted, the latest production version is used. Supplying a `version`
locks behaviour to that specific model version, enabling reproducible results
even after future upgrades.
For the sentiment endpoint, the supported versions are:
- "2025-08-17" — default and recommended.
- "original" — legacy behaviour.
For the themes endpoint, the supported versions are:
- "original" — default and legacy behaviour.
- "2025-09-01" — opt-in model with `themeSets` responses.
servers:
- url: https://pulse.researchwiseai.com/v1
description: Production API server
- url: https://staging.pulse.researchwiseai.com/v1
description: Staging API server
security:
- BearerAuth: []
tags:
- name: embeddings
description: |
Embeddings endpoint. Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings and returns embeddings immediately (HTTP 200).
- In asynchronous mode, accepts up to 5,000 input strings and returns a job_id (HTTP 202) to poll via /jobs.
- name: similarity
description: |
Similarity endpoint. Provides self- and cross-similarity computations with sync (fast=true) and async (fast=false or omitted) modes.
- In synchronous mode, self-similarity supports up to 500 strings; cross-similarity requires |set_a|×|set_b| ≤ 20,000 (HTTP 200).
- In asynchronous mode, supports larger inputs (self up to 44,721 strings; cross with |set_a|×|set_b| ≤ 2,000,000,000) and returns a job_id (HTTP 202).
- name: themes
description: |
Themes endpoint. Clusters text into themes with sync (fast=true) and async (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings and returns themes immediately (HTTP 200).
- In asynchronous mode, accepts up to 500 input strings and returns a job_id (HTTP 202).
- name: clustering
description: |
Clustering endpoint. Groups texts into clusters using kmeans, spherical k-means (skmeans), agglomerative, or HDBSCAN algorithms operating on full embeddings.
- In synchronous mode, processes up to 500 input strings and returns clusters immediately (HTTP 200).
- In asynchronous mode, accepts up to 44,721 input strings and returns a job_id (HTTP 202).
- name: sentiment
description: |
Sentiment endpoint. Classifies sentiment with sync (fast=true) and async (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings (HTTP 200).
- In asynchronous mode, accepts up to 5,000 input strings and returns a job_id (HTTP 202).
- name: extractions
description: |
Extractions endpoint. Extracts mentions using a provided dictionary, with prompt style controlled by `type` (`named-entities` default, or `themes`).
- In synchronous mode, processes up to 200 input strings and returns results immediately (HTTP 200).
- In asynchronous mode, accepts up to 5,000 input strings and returns a job_id (HTTP 202).
- name: data-dictionary
description: |
Data Dictionary endpoint. Analyzes 2D arrays of data cells and generates comprehensive DDI (Data Documentation Initiative) Codebook documentation in JSON format.
- Only supports asynchronous mode (fast=false) to handle potentially large datasets without timeout constraints.
- Accepts up to 50,000 rows × 1,000 columns (max 100,000 total cells) and returns a job_id (HTTP 202) to poll via /jobs.
- name: jobs
description: |
Jobs endpoint. Poll job status for asynchronous requests generated by other endpoints.
- Retrieve status and result URL for completed jobs.
- name: usage
description: |
Estimate credit usage for a task without authentication.
- name: system
description: |
System endpoints.
paths:
/embeddings:
post:
operationId: createEmbeddings
summary:
Generate dense vector embeddings for input strings (synchronous or asynchronous).
description: |
Generates dense vector embeddings for input strings in a single batch.
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
• Synchronous mode processes up to 200 input strings and returns embeddings immediately (HTTP 200).
• Asynchronous mode accepts up to 5,000 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
tags: [embeddings]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/EmbeddingsRequest'
examples:
Default:
summary: Sample embeddings request
value:
inputs: ['Hello world', 'Test input']
WithProvider:
summary: Embeddings request with provider override
value:
inputs: ['Hello world']
provider:
type: openai
auth:
api_key: 'example-key'
endpoint: 'https://api.openai.com/v1'
responses:
'200':
description: Embeddings successfully created.
content:
application/json:
schema:
$ref: '#/components/schemas/EmbeddingsResponse'
examples:
EmbeddingsResponseExample:
summary: Sample successful response
value:
embeddings:
- text: 'Hello world'
vector: [0.1, 0.2, 0.3]
- text: 'Test input'
vector: [0.4, 0.5, 0.6]
requestId: 'example-request-id'
'400':
description:
Bad request - validation error (e.g., >200 strings, invalid provider spec).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InvalidEmbeddingsRequest:
summary: Sample validation error response
value:
code: validation_error
message: 'inputs must be an array of up to 200 strings'
errors:
- message: 'Too many items'
path: ['inputs']
field: inputs
location: body
InvalidProviderSpec:
summary: Invalid provider specification
value:
code: validation_error
message: 'provider spec is invalid'
errors:
- message: 'Invalid provider'
path: ['provider']
field: provider
location: body
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/similarity:
post:
operationId: compareSimilarity
summary: Compute cosine similarity between strings (self or cross).
description: |
Computes pairwise cosine similarity between input strings.
Supports self-similarity (provide `set`) and cross-similarity (provide `set_a` and `set_b`), with synchronous (`fast=true`) and asynchronous (`fast=false` or omitted) modes.
• In synchronous mode, self-similarity supports up to 500 input strings; cross-similarity requires |set_a|×|set_b| ≤ 20,000. Returns similarities immediately (HTTP 200).
• In asynchronous mode, supports larger inputs (self up to 44,721 items; cross with |set_a|×|set_b| ≤ 2,000,000,000) and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
tags: [similarity]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SimilarityRequest'
examples:
SelfExample:
summary: Self-similarity request
value:
set: ['alpha', 'beta', 'gamma']
CrossExample:
summary: Cross-similarity request
value:
set_a: ['apple', 'banana']
set_b: ['orange', 'pear']
version: 'original'
SplitExample:
summary: Sentence and newline splitting
value:
set_a: ["red\nblue"]
set_b: ['Hello world. Goodbye world.']
split:
set_a: newline
set_b:
unit: sentence
agg: max
flatten: true
WithProvider:
summary: Similarity request with provider override
value:
set: ['a', 'b']
provider:
type: openai
auth:
api_key: 'example-key'
responses:
'200':
description: Similarity values returned successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SimilarityResponse'
examples:
SimilarityMatrixExample:
summary: Cross-similarity matrix response
value:
scenario: 'cross'
mode: 'matrix'
matrix: [[1.0, 0.8], [0.8, 1.0]]
flattened: [1.0, 0.8, 0.8, 1.0]
requestId: 'example-request-id'
SplitResponseExample:
summary: Sentence/newline splitting response
value:
scenario: 'cross'
mode: 'flattened'
n: 1
flattened: [0.9]
requestId: 'example-request-id'
'400':
description:
Bad request - validation error (e.g., invalid input, unsupported provider).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InvalidSimilarityRequest:
summary: Sample validation error response
value:
code: validation_error
message:
"either 'set' or both 'set_a' and 'set_b' must be
provided"
errors:
- message: 'Missing required fields'
location: body
UnsupportedProvider:
summary: Unsupported provider
value:
code: validation_error
message: 'provider is unsupported'
errors:
- message: 'Unsupported provider'
path: ['provider']
field: provider
location: body
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/themes:
post:
operationId: generateThemes
summary: Cluster open-ended text responses into thematic groups.
description: |
Groups input strings into latent themes using LLM-based clustering.
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings and returns themes immediately (HTTP 200).
- In asynchronous mode, accepts up to 500 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
Each theme includes a `shortLabel`, `label`, `description`, and exactly two representative input strings.
Optionally control theme count with `minThemes`, `maxThemes`, and steer focus via `context`.
tags: [themes]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ThemesRequest'
examples:
Default:
summary: Basic themes request
value:
inputs: ['fast service', 'slow response', 'easy setup']
WithOptions:
summary: Themes request with options
value:
inputs: ['app crashes on launch', 'error message shown']
minThemes: 2
maxThemes: 5
context: 'focus on reliability issues'
version: '2025-09-01'
prune: 5
interactive: true
initialSets: 2
WithProvider:
summary: Themes request with provider override
value:
inputs: ['service great', 'service slow']
provider:
type: openai
auth:
api_key: 'example-key'
responses:
'200':
description: Thematic clustering completed successfully.
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ThemesResponse'
- $ref: '#/components/schemas/ThemeSetsResponse'
examples:
ThemesResponseExample:
summary: Sample themes response
value:
themes:
- shortLabel: 'UI Issue'
label: 'User Interface Issues'
description: 'Problems related to layout and design.'
representatives:
- 'Button not aligned'
- 'Text too small'
requestId: 'example-request-id'
'400':
description: Bad request - validation error (e.g., inputs >200 strings).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InvalidThemesRequest:
summary: Sample validation error response
value:
code: validation_error
message: 'inputs must be an array of 2 to 500 strings'
errors:
- message: 'Too few items'
path: ['inputs']
field: inputs
location: body
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/clustering:
post:
operationId: clusterTexts
summary: Cluster texts using vector embeddings.
description: |
Performs server-side clustering of input strings using algorithms that operate on full embeddings.
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- In synchronous mode, processes up to 500 input strings and returns clusters immediately (HTTP 200).
- In asynchronous mode, accepts up to 44,721 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
tags: [clustering]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ClusteringRequest'
examples:
Default:
summary: Basic clustering request
value:
inputs: ['doc one', 'doc two']
k: 2
WithAlgorithm:
summary: Specify algorithm
value:
inputs: ['a', 'b', 'c']
k: 2
algorithm: agglomerative
HDBSCAN:
summary: Use HDBSCAN
value:
inputs: ['a', 'b', 'c', 'd']
k: 2
algorithm: hdbscan
SKMeans:
summary: Use spherical k-means
value:
inputs: ['one', 'two', 'three']
k: 2
algorithm: skmeans
responses:
'200':
description: Clustering completed successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ClusteringResponse'
'400':
description: Bad request - validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/sentiment:
post:
operationId: analyzeSentiment
summary: Classify sentiment of each input string.
description: |
Classifies the sentiment of each input string as positive, negative, neutral, or mixed, with confidence scores ∈ [0,1].
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings and returns results immediately (HTTP 200).
- In asynchronous mode, accepts up to 5,000 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
Optionally supply `version` for reproducible outputs. Supported values are "2025-08-17" (default, recommended) and "original".
tags: [sentiment]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SentimentRequest'
examples:
Default:
summary: Basic sentiment request
value:
inputs: ['I love this', 'I hate that']
WithVersion:
summary: Sentiment request with version
value:
inputs: ['It was okay']
version: '2025-08-17'
OriginalVersion:
summary: Sentiment request using legacy version
value:
inputs: ['It was okay']
version: 'original'
WithProvider:
summary: Sentiment request with provider override
value:
inputs: ['Great service']
provider:
type: openai
auth:
api_key: 'example-key'
responses:
'200':
description: Sentiment analysis results.
content:
application/json:
schema:
$ref: '#/components/schemas/SentimentResponse'
examples:
SentimentResponseExample:
summary: Sample sentiment response
value:
results:
- sentiment: 'positive'
confidence: 0.95
- sentiment: 'negative'
confidence: 0.85
requestId: 'example-request-id'
'400':
description: Bad request - validation error (e.g., invalid endpoint).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InvalidSentimentRequest:
summary: Sample validation error response
value:
code: validation_error
message: 'inputs must be an array of 1 to 5000 strings'
InvalidEndpoint:
summary: Invalid provider endpoint
value:
code: validation_error
message: 'provider endpoint is invalid'
errors:
- message: 'Invalid endpoint'
path: ['provider', 'endpoint']
field: provider.endpoint
location: body
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/extractions:
post:
operationId: extractElements
summary: Extract terms or theme mentions from input texts.
description: |
Extracts mentions from each input based on a provided dictionary.
Optionally expands the dictionary before matching. The optional `type` parameter
selects prompt style: `named-entities` (default) or `themes`.
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- In synchronous mode, processes up to 200 input strings and returns results immediately (HTTP 200).
- In asynchronous mode, accepts up to 5,000 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
tags: [extractions]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractionsRequest'
examples:
Default:
summary: Basic extractions request (named entities)
value:
inputs: ['The food was great and the service was slow.']
dictionary: ['service', 'wait time']
type: 'named-entities'
Themes:
summary: Extractions using theme labels
value:
inputs: ['Checkout was confusing and payment failed twice']
dictionary: ['Checkout UX', 'Payments', 'Account setup']
type: 'themes'
WithProvider:
summary: Extractions request with provider override
value:
inputs: ['Great food']
dictionary: ['food']
provider:
type: openai
auth:
api_key: 'example-key'
responses:
'200':
description: Extraction results returned successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractionsResponse'
examples:
ExtractionsResponseExample:
summary: Sample extractions response
value:
dictionary: ['service', 'wait time']
results:
- [['service'], ['service was slow']]
requestId: 'example-request-id'
'202':
description:
Accepted for asynchronous processing (fast=false). Returns a job_id to poll
via /jobs.
content:
application/json:
schema:
type: object
properties:
job_id:
type: string
required: [job_id]
additionalProperties: false
'400':
description: Bad request - validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InvalidExtractionsRequest:
summary: Sample validation error response
value:
code: validation_error
message: 'invalid extraction request'
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/summaries:
post:
operationId: generateSummary
summary: Summarize text according to a question.
description: |
Generates a short summary from the provided inputs.
Supports synchronous (fast=true) and asynchronous (fast=false or omitted) modes.
- Synchronous mode accepts up to 200 input strings and returns the summary immediately (HTTP 200).
- Asynchronous mode accepts up to 5,000 input strings and returns a job_id (HTTP 202) to poll via the /jobs endpoint.
tags: [summaries]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SummariesRequest'
examples:
Default:
summary: Basic summaries request
value:
inputs: ['Hello world']
question: 'What is said?'
responses:
'200':
description: Summary returned successfully.
content:
application/json:
schema:
$ref: '#/components/schemas/SummariesResponse'
'400':
description: Bad request - validation error.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
InsufficientCredits:
summary: Not enough credits
value:
code: insufficient_credits
message: 'Insufficient credits'
meta:
balance: 10
required: 12
/data-dictionary:
post:
operationId: generateDataDictionary
summary: Generate DDI Codebook documentation from 2D data arrays.
description: |
Analyzes 2D arrays of data cells and generates comprehensive DDI (Data Documentation Initiative) Codebook documentation in JSON format.
Uses OpenAI's agent capabilities with structured output to intelligently analyze data patterns, infer variable types, detect value ranges, and generate meaningful metadata descriptions that conform to DDI standards.
**Asynchronous Processing Only**: This endpoint only supports asynchronous mode (fast=false or omitted) to handle potentially large datasets without timeout constraints.
Returns a job_id (HTTP 202) to poll via the /jobs endpoint.
**Data Limits**:
- Maximum 50,000 rows
- Maximum 1,000 columns
- Maximum 100,000 total cells
- Each cell must be a string value
**Generated DDI Codebook includes**:
- Variable names, labels, and descriptions following DDI standards
- Data type inference and measurement level classification
- Value domains with categorical codes and labels
- Statistical summaries for numeric variables
- Missing value documentation and patterns
- Dataset-level metadata (title, description, creation date)
tags: [data-dictionary]
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DataDictionaryRequest'
examples:
BasicExample:
summary: Basic data dictionary request
value:
data:
[
['Name', 'Age', 'City', 'Satisfaction'],
['John Doe', '25', 'New York', 'Very Satisfied'],
['Jane Smith', '30', 'Los Angeles', 'Satisfied'],
['', '35', 'Chicago', 'Neutral'],
['Bob Johnson', 'invalid', 'Houston', 'Dissatisfied'],
]
WithOptions:
summary: Data dictionary request with metadata options
value:
data:
[
['Product', 'Rating', 'Recommend'],
['Widget A', 'Excellent', 'Yes'],
['Widget B', 'Good', 'Yes'],
['Widget C', 'Poor', 'No'],
]
options:
title: 'Product Feedback Survey'
description: 'Customer satisfaction survey responses'
context:
'Focus on product quality and recommendation patterns'
language: 'en'
CategoricalData:
summary: Categorical data with missing values
value:
data:
[
['Department', 'Satisfaction', 'Years'],
['Engineering', 'Very Satisfied', '3'],
['Marketing', 'Satisfied', '1'],
['Sales', '', '5'],
['', 'Dissatisfied', '2'],
]
NumericData:
summary: Numeric data for statistical analysis
value:
data:
[
['Temperature', 'Humidity', 'Pressure'],
['23.5', '65', '1013.25'],
['24.1', '68', '1012.80'],
['22.8', 'invalid', '1014.10'],
['', '70', '1013.00'],
]
responses:
'202':
description:
Accepted for asynchronous processing. Returns a job_id to poll via /jobs.
content:
application/json:
schema:
type: object
properties:
job_id:
type: string
description: Unique identifier for the asynchronous job
required: [job_id]
additionalProperties: false
examples:
AcceptedResponse:
summary: Job accepted for processing
value:
job_id: 'dd_abc123def456'
'400':
description: Bad request - validation error or fast mode attempted.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
FastModeError:
summary: Fast mode not supported
value:
code: invalid_request
message:
'Data dictionary generation only supports asynchronous
mode (fast=false)'
errors:
- message: 'Fast mode not supported'
location: body
field: fast
EmptyDataError:
summary: Empty data array
value:
code: validation_error
message: 'Data array cannot be empty'
errors:
- message: 'Data array cannot be empty'
path: ['data']
field: data
location: body
InvalidStructureError:
summary: Invalid 2D array structure
value:
code: validation_error
message: 'All rows must have the same number of columns'
errors:
- message: 'Inconsistent row lengths'
path: ['data']
field: data
location: body
DataTooLargeError:
summary: Data exceeds size limits
value:
code: validation_error
message: 'Data cannot exceed 100,000 total cells'
errors:
- message: 'Too many cells'
path: ['data']
field: data
location: body
'401':
description: Missing or invalid authorization (organization).
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
examples:
MissingOrg:
summary: Missing organization
value:
code: auth_missing_organization
message: 'Missing organizationId'
'402':
description: Insufficient credits to process the request.
content:
application/json:
schema: