-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathopenapi.yaml
More file actions
4702 lines (4416 loc) · 141 KB
/
Copy pathopenapi.yaml
File metadata and controls
4702 lines (4416 loc) · 141 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"
servers:
- url: https://api.tensorlake.ai/
info:
title: Tensorlake API
description: Tensorlake Cloud APIs for Document Ingestion and Serverless Workflows
license:
name: ""
version: "0.1.0"
security:
- bearerAuth: []
paths:
/documents/v1/datasets:
get:
tags:
- datasets
operationId: list_datasets
parameters:
- name: cursor
in: query
description: Cursor to paginate through the list of jobs
required: false
schema:
type: string
- name: limit
in: query
description: Limit the number of jobs to return
required: false
schema:
type: integer
format: int64
minimum: 0
- name: direction
in: query
description: Direction to paginate through the list of jobs
required: false
schema:
type: string
enum:
- next
- prev
- name: status
in: query
description: Filter datasets by status
required: false
schema:
type: string
enum:
- idle
- processing
responses:
"200":
description: List datasets
content:
application/json:
schema:
$ref: "#/components/schemas/Page_DatasetListItem"
"400":
description: Invalid request parameters. Check the cursor and direction values
content:
text/plain: {}
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
post:
tags:
- datasets
summary: |-
Create a new dataset. They are used in conjunction with the Structurued Data
or Documetn Parsing API requests. Behavior of datasets when used with the
APIs:
* Structured Extraction API - Structured Data from files are automatically
inserted into datasets. A JSON schema is required to guide the extraction.
* Document Parsing API - Chunks of parsed documents from the Document
Parsing API automatically.
operationId: create_dataset
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateDatasetRequest"
required: true
responses:
"200":
description: Create a new dataset. Reference the name to insert structured data from documents extracted by the Structured Extraction API automatically.
content:
application/json:
schema:
$ref: "#/components/schemas/CreateDatasetResponse"
"400":
description: Invalid request. The dataset name must be alphanumeric, hyphens, and underscores, and the JSON schema must be valid.
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
/documents/v1/datasets/{dataset_name}:
get:
tags:
- datasets
operationId: find_dataset
parameters:
- name: dataset_name
in: path
required: true
schema:
type: string
responses:
"200":
description: Get a dataset
content:
application/json:
schema:
$ref: "#/components/schemas/DatasetResponse"
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
put:
tags:
- datasets
operationId: update_dataset
parameters:
- name: dataset_name
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateDatasetRequest"
required: true
responses:
"200":
description: Get a dataset
content:
application/json:
schema:
$ref: "#/components/schemas/DatasetResponse"
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
post:
tags:
- datasets
operationId: add_file_to_dataset
parameters:
- name: dataset_name
in: path
required: true
schema:
type: string
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type:
- string
- "null"
format: binary
description: |-
The file to ingest into the dataset.
This field must be provided if the `file_id` is not provided.
The file should be a binary file, and it will be uploaded to the server.
file_id:
type:
- string
- "null"
description: |-
The Tensorlake file ID to ingest into the dataset.
This field must be provided if the `file` is not provided.
The file ID should be a valid Tensorlake file ID.
A valid file ID is a string that starts with `tensorlake-` (if uploaded
via Files V1), or `file_` (if uploaded via Files V2); followed by a
readable identifier.
pages:
type:
- string
- "null"
description: |-
The page range to ingest into the dataset.
This field is optional and defaults to `None`, which means all pages
will be ingested. If provided, it should be a string in the format
"start-end", where `start` and `end` are page numbers. For example,
"1-10" will ingest pages 1 to 10.
labels:
type:
- object
- "null"
description: |-
The labels to apply to the ingest operation of the file.
Labels should be in the format of key=value pairs, e.g. key1=value1; or
as a JSON object.
For adding multiple labels, use different form-data fields with the same
key.
Example:
POST /documents/v1/files
Content-Type: multipart/form-data; boundary=----boundary
------boundary
Content-Disposition: form-data; name="labels"
owner=JohnDoe
------boundary
Content-Disposition: form-data; name="labels"
project=Tensorlake
Labels can also be provided as a JSON object:
------boundary
Content-Disposition: form-data; name="labels"
{"owner": "JohnDoe", "project": "Tensorlake"}
Labels are optional and can be used to store additional information
about the file.
additionalProperties: {}
propertyNames:
type: string
required: true
responses:
"200":
description: Extend a dataset
content:
application/json:
schema:
$ref: "#/components/schemas/JobDispatchedResponse"
"400":
description: Invalid request. Check the file and pages fields
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found.
"500":
description: Internal server error
delete:
tags:
- datasets
summary: Delete a dataset. This will remove all data associated with the dataset.
operationId: delete_dataset
parameters:
- name: dataset_name
in: path
required: true
schema:
type: string
responses:
"204":
description: Delete a dataset
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
/documents/v1/datasets/{dataset_name}/jobs:
get:
tags:
- datasets
operationId: list_dataset_jobs
parameters:
- name: cursor
in: query
description: Cursor to paginate through the list of jobs
required: false
schema:
type: string
- name: limit
in: query
description: Limit the number of jobs to return
required: false
schema:
type: integer
format: int64
minimum: 0
- name: direction
in: query
description: Direction to paginate through the list of jobs
required: false
schema:
type: string
enum:
- next
- prev
- name: status
in: query
description: Filter jobs by status
required: false
schema:
type: string
enum:
- failure
- pending
- processing
- successful
- name: job_id
in: query
description: Filter jobs by job ID
required: false
schema:
type: string
- name: filename
in: query
description: Filter jobs by filename
required: false
schema:
type: string
- name: without_outputs
in: query
description: Exclude outputs from the response
required: false
schema:
type: boolean
- name: created_after
in: query
description: Filter jobs created after a specific date. Date is inclusive and must be in RFC3339 format
required: false
schema:
type: string
- name: created_before
in: query
description: Filter jobs created before a specific date. Date is inclusive and must be in RFC3339 format
required: false
schema:
type: string
- name: dataset_name
in: path
required: true
schema:
type: string
responses:
"200":
description: List jobs for a dataset
content:
application/json:
schema:
$ref: "#/components/schemas/Page_DatasetJobItem"
"400":
description: Invalid request parameters. Check the cursor and direction values
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Dataset not found
"500":
description: Internal server error
/documents/v1/files:
get:
tags:
- files
operationId: list_files
parameters:
- name: cursor
in: query
description: Cursor to paginate through the list of jobs
required: false
schema:
type: string
- name: limit
in: query
description: Limit the number of jobs to return
required: false
schema:
type: integer
format: int64
minimum: 0
- name: direction
in: query
description: Direction to paginate through the list of jobs
required: false
schema:
type: string
enum:
- next
- prev
- name: filename
in: query
description: Filter by filename. The search is case-sensitive
required: false
schema:
type: string
- name: created_after
in: query
description: Filter by created after. The date is inclusive, and it must be in RFC3339 format
required: false
schema:
type: string
- name: created_before
in: query
description: Filter by created before. The date is inclusive, and it must be in RFC3339 format
required: false
schema:
type: string
responses:
"200":
description: List all files
content:
application/json:
schema:
$ref: "#/components/schemas/Page_FileResponse"
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
post:
tags:
- files
operationId: upload_file
requestBody:
content:
multipart/form-data:
schema:
type: object
required:
- file
properties:
labels:
type:
- object
- "null"
description: |-
Labels for the file, can be used to store metadata
Labels should be in the format of key=value pairs, e.g. key1=value1; or
as a JSON object.
For adding multiple labels, use different form-data fields with the same
key.
Example:
POST /documents/v1/files
Content-Type: multipart/form-data; boundary=----boundary
------boundary
Content-Disposition: form-data; name="labels"
owner=JohnDoe
------boundary
Content-Disposition: form-data; name="labels"
project=Tensorlake
Labels can also be provided as a JSON object:
------boundary
Content-Disposition: form-data; name="labels"
{"owner": "JohnDoe", "project": "Tensorlake"}
Labels are optional and can be used to store additional information
about the file.
additionalProperties: {}
propertyNames:
type: string
file:
type: string
format: binary
description: |-
The file to upload, must be a valid file
The file should be sent as a binary file in the request body.
The file will be stored in the database and can be accessed later.
required: true
responses:
"200":
description: File uploaded successfully
content:
application/json:
schema:
$ref: "#/components/schemas/UploadFileResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
/documents/v1/files/{id}:
get:
tags:
- files
operationId: download_file
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Download a file
content:
application/json:
schema:
$ref: "#/components/schemas/DownloadFileResponse"
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: File not found
"500":
description: Internal server error
delete:
tags:
- files
operationId: delete_file
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
"200":
description: Delete a file
"404":
description: File not found
"500":
description: Internal server error
/documents/v1/files_large:
post:
tags:
- files
summary: Start the upload process for any file larger than 10MB.
description: |-
This endpoint is the first step in the upload process. There are a total of
3 steps:
1. **Upload File Init**: This endpoint is called first to initiate the
upload process. The response
contains a presigned URL that can be used to upload the file.
2. **Upload File**: The file is uploaded to the presigned URL. This should
be done using a
multipart/form-data request via a PUT request.
3. **Upload File Finalize**: This endpoint is called to finalize the upload
process. It verifies the
file and updates the database with the file information.
operationId: upload_large_file_init
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/UploadLargeFileInitRequest"
required: true
responses:
"200":
description: Response object with the temporary File ID and the presigned URL.
content:
application/json:
schema:
$ref: "#/components/schemas/UploadLargeFileInitResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"422":
description: Invalid payload provided
"500":
description: Internal server error
/documents/v1/files_large/{presigned_id}:
post:
tags:
- files
summary: Finalize the upload process for a large file.
description: |-
This endpoint is the last step in the upload process. It verifies the file
and updates the database with the file information.
This endpoint is called after the file has been uploaded to the presigned
URL.
The expected id argument is the one returned from the upload_large_file_init
endpoint.
operationId: upload_large_file_finalize
parameters:
- name: presigned_id
in: path
required: true
schema:
type: string
responses:
"200":
description: Response with the permanent File ID
content:
application/json:
schema:
$ref: "#/components/schemas/UploadFileResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
/documents/v1/jobs:
get:
tags:
- jobs
operationId: list_jobs
parameters:
- name: cursor
in: query
description: Cursor to paginate through the list of jobs
required: false
schema:
type: string
- name: limit
in: query
description: Limit the number of jobs to return
required: false
schema:
type: integer
format: int64
minimum: 0
- name: direction
in: query
description: Direction to paginate through the list of jobs
required: false
schema:
type: string
enum:
- next
- prev
- name: filename
in: query
description: Filter jobs based on the filename used
required: false
schema:
type: string
- name: job_id
in: query
description: Filter jobs based on the job id used
required: false
schema:
type: string
- name: dataset_name
in: query
description: Filter jobs based on the dataset name used
required: false
schema:
type: string
- name: status
in: query
description: Filter jobs based on the status
required: false
schema:
type: string
enum:
- failure
- pending
- processing
- successful
- name: created_after
in: query
description: Filter jobs created after the given date. Date should be in RFC3339 format
required: false
schema:
type: string
- name: created_before
in: query
description: Filter jobs created before the given date. Date should be in RFC3339 format
required: false
schema:
type: string
- name: updated_after
in: query
description: Filter jobs updated after the given date. Date should be in RFC3339 format
required: false
schema:
type: string
- name: updated_before
in: query
description: Filter jobs updated before the given date. Date should be in RFC3339 format
required: false
schema:
type: string
responses:
"200":
description: List all jobs
content:
application/json:
schema:
$ref: "#/components/schemas/Page_JobListItem"
"400":
description: Unable to list jobs
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
/documents/v1/jobs/{job_id}:
get:
tags:
- jobs
operationId: fetch_job
parameters:
- name: job_id
in: path
description: The identifier of the job given at creation. Starts with job-
required: true
schema:
type: string
responses:
"200":
description: Get Job Output
content:
application/json:
schema:
$ref: "#/components/schemas/JobResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
delete:
tags:
- jobs
operationId: delete_job
parameters:
- name: job_id
in: path
description: The identifier of the job given at creation. Starts with job-
required: true
schema:
type: string
responses:
"204":
description: Job is deleted
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"404":
description: Job not found
"500":
description: Internal server error
/documents/v1/parse:
post:
tags:
- parse
operationId: parse
requestBody:
content:
application/json:
schema:
type: object
properties:
file:
type:
- string
- "null"
description: |-
The file to parse.
This can be a remote file URL or a tensorlake file (e.g. `file_***`).
If a remote file URL is provided, the file will be downloaded and
parsed.
For a tensorlake file, the file needs to be uploaded to the server
first.
This field is optional and is only used if the `content` field is not
provided.
If both fields are provided, this field takes precedence.
content:
type:
- string
- "null"
description: |-
The content to parse.
This can be any kind of text e.g. an email content, or an HTML page.
This field is optional and is only used if the `file` field is not
provided.
If both fields are provided, the `file` field takes precedence.
mimeType:
oneOf:
- $ref: "#/components/schemas/MimeType"
description: |-
The MIME type of the content.
This is used to determine the type of file being parsed and
to select the appropriate parsing strategy.
If not provided, the MIME type will default to `text/plain`.
This field is optional and is only used if the `content` field is
provided.
default: text/plain
pages:
type:
- string
- "null"
description: |-
The page number to parse.
This is only used if the `file` field is provided, and is a pageable
file (e.g. PDF). If not provided, all pages will be parsed.
settings:
$ref: "#/components/schemas/Settings"
labels:
type:
- object
- "null"
description: Additional metadata for the job.
additionalProperties: {}
propertyNames:
type: string
required: true
responses:
"200":
description: Parse pages from a file
content:
application/json:
schema:
$ref: "#/components/schemas/JobDispatchedResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
/documents/v1/webhooks:
post:
tags:
- webhook
summary: |-
Configure a webhook for receiving events from Tensorlake
You will get a URL to configure endpoints of your choice
operationId: configure_webhook
responses:
"200":
description: Webhook configured successfully
content:
application/json:
schema:
$ref: "#/components/schemas/ConfigureWebhookResponse"
"400":
description: Invalid request
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
/documents/v2/datasets:
get:
tags:
- datasets
operationId: list_datasets_v2
parameters:
- name: cursor
in: query
description: |-
Optional cursor for pagination.
This is a base64-encoded string representing a timestamp.
It is used to paginate through the results.
required: false
schema:
oneOf:
- type: "null"
- $ref: "#/components/schemas/Cursor"
- name: direction
in: query
description: |-
The direction of pagination.
This can be either `next` or `prev`.
The default is `next`, which means the next page of results will be
returned.
required: false
schema:
$ref: "#/components/schemas/PaginationDirection"
- name: limit
in: query
description: |-
The maximum number of results to return per page.
The default is 25.
required: false
schema:
type: integer
minimum: 0
- name: status
in: query
description: |-
The status dataset to filter the results by.
This is an optional parameter that can be used to filter the results
by the status of the dataset.
The possible values are `processing` and `idle``.
required: false
schema:
oneOf:
- type: "null"
- $ref: "#/components/schemas/DatasetStatus"
- name: name
in: query
description: |-
The name of the dataset to filter the results by.
This is an optional parameter that can be used to filter the results
by the name of the dataset.
Because dataset names are not unique, this will return all datasets
that match the provided name.
required: false
schema:
type:
- string
- "null"
responses:
"200":
description: List of datasets retrieved successfully
content:
application/json:
schema:
$ref: "#/components/schemas/PaginatedResult_Dataset"
"401":
description: Unauthorized. Invalid or missing credentials
"403":
description: Forbidden. You do not have permission to access this resource
"500":
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
post:
tags:
- datasets
operationId: create_dataset_v2
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DatasetCreateRequest"
required: true
responses:
"200":
description: Dataset created successfully
content:
application/json:
schema:
$ref: "#/components/schemas/DatasetCreatedResponse"
"400":
description: Invalid dataset creation request
content:
application/json: