-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi_extraction.yml
1711 lines (1505 loc) · 63.7 KB
/
openapi_extraction.yml
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.0.3
servers:
- url: https://api.sensible.so/v0
description: Production server (uses live data)
info:
title: Extraction
version: 0.0.0
license:
name: Sensible API
url: https://www.TBD.org/licenses/LICENSE-2.0.html
description: Extract structured data from documents with the Sensible API.
security:
- bearerAuth: []
tags:
- name: Document
description: "Extract data from documents"
- name: Portfolio
description: "Extract data from multiple documents bundled into single PDF files"
- name: Retrieve extractions
description: "Retrieve data extracted asynchronously from documents"
- name: Get Excel from documents
description: "Convert extracted document data to spreadsheet"
paths:
/extract/{document_type}:
post:
operationId: extract-data-from-a-document
summary: Extract data from a document (sync)
description: |
**Note:** Use this endpoint for testing. Use the asynchronous extraction endpoints for production.
Extract data from a local document synchronously.
To explore this endpoint, use this interactive API reference, or use one of the following options:
- For a quick "hello world" response to this endpoint, see the [API quickstart](https://sensible.mintlify.app/.app/integrations/quickstart)
- For a step-by-step tutorial about calling this endpoint, see [Try synchronous extraction](https://sensible.mintlify.app/.app/api-guides/api-tutorial/api-tutorial-sync).
- Run this endpoint in the Sensible Postman collection. [Run in Postman](https://god.gw.postman.com/run-collection/16839934-45339059-3fec-4c31-a891-9a12a3e1c22b?action=collection%2Ffork&collection-url=entityId%3D16839934-45339059-3fec-4c31-a891-9a12a3e1c22b%26entityType%3Dcollection%26workspaceId%3Ddbde09dc-b7dd-487d-a68f-20d32b008f90)
There are two options for posting the document bytes.
1. (often preferred) specify the non-encoded document bytes as the entire request body,and specify the `Content-Type` header, for example,"application/pdf" or "image/jpeg".
See the following for supported file formats.
2. Base64 encode the document bytes, specify them in a body "document" field, and specify application/json for the `Content-Type` header.
For a list of supported document file types, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
required: true
content:
image/jpeg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/tiff:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/pdf:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/msword:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/vnd.openxmlformats-officedocument.wordprocessingml.document:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/json:
schema:
$ref: '#/components/schemas/encodedPdf'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractionSingleResponse'
description: |
The structured data extracted from the document.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/generate_upload_url/{document_type}:
post:
operationId: generate-an-upload-url
summary: Extract doc at a Sensible URL
description: |
Extract data asynchronously from a document with the following steps:
1. Use this endpoint to generate a Sensible URL.
2. PUT your document at the `upload_url` returned from the previous step. Sensible extracts data from the document.
3. To retrieve the extraction, use a webhook, or use the extraction `id` returned in the response to poll the GET documents/{id} endpoint.
For supported file size and types, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
For example, if your call to `/generate_upload_url` specifies the document type with a `content_type` body parameter (recommended), your first two steps are as follows:
Step 1. Generate the Sensible URL:
```curl
curl --location 'https://api.sensible.so/v0/generate_upload_url/<YOUR_DOCUMENT_TYPE>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer REDACTED' \
--data '{"content_type":"application/pdf"}'
```
Step 2. PUT the document:
```curl
curl --location --request PUT 'https://sensible-so-utility-bucket-dev-us-west-2.s3.us-west-2.amazonaws.com/REDACTED' \
--header 'Content-Type: application/pdf' \
--data 'YOUR_PATH_TO_DOCUMENT.pdf'
```
Note that in step 2:
- you must omit an authorization header
- the `Content-Type` header must match the `content_type` body parameter in step 1
- the pre-signed `upload_url` doesn't support Base64 encoded documents, so you PUT the document bytes directly to the endpoint.
For a step-by-step tutorial on calling this endpoint, see
[Try asynchronous extraction from a Sensible URL](https://docs.sensible.so/docs/api-tutorial-async-2).
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GenerateUrlRequest'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UploadResponse'
description: Returns the upload_url at which to PUT the document for extraction
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/extract_from_url/{document_type}:
post:
operationId: provide-a-download-url
summary: Extract doc at your URL
description: |
Extract data asynchronously from a document at the specified `document_url`.<br/>
For supported file size and types, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
Take the following steps.
1. Run this endpoint.
3. To retrieve the extraction, use a webhook, or use the extraction `id` returned in the response to poll the GET documents/{id} endpoint.
For a step-by-step tutorial on calling this endpoint,
see [Try asynchronous extraction from your URL](https://sensible.mintlify.app/.app/api-guides/api-tutorial/api-tutorial-async-1).
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractFromUrlRequest'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractFromUrlResponse'
description: Returns the ID to use to retrieve the extraction
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/extract/{document_type}/{config_name}:
post:
operationId: extract-data-from-a-document-with-config
summary: Extract data from a document using specified config
description: |
This endpoint's behavior identical to the [Extract data from a document](ref:extract-data-from-a-document) endpoint's behavior, except that Sensible uses the specified config to extract data from the document instead of automatically choosing the best-scoring extraction in the document type.
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/config_name'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
required: true
content:
image/jpeg:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/tiff:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/pdf:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/msword:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/vnd.openxmlformats-officedocument.wordprocessingml.document:
schema:
type: string
format: binary
description: non-encoded document bytes as the entire request body
application/json:
schema:
$ref: '#/components/schemas/encodedPdf'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractionSingleResponse'
description: |
The structured data extracted from the document.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/generate_upload_url/{document_type}/{config_name}:
post:
operationId: generate-an-upload-url-with-config
summary: Extract doc at a Sensible URL using specified config
description: |
This endpoint's behavior is identical to the [Extract doc at a Sensible URL](ref:generate-upload-url) endpoint's behavior, except that Sensible uses the specified config to extract data from the document instead of automatically choosing the best-scoring extraction in the document type.
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
- $ref: '#/components/parameters/config_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/GenerateUrlRequest'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UploadResponse'
description: Returns the upload_url at which to PUT the document for extraction
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/extract_from_url/{document_type}/{config_name}:
post:
operationId: provide-a-download-url-with-config
summary: Extract doc at your URL using config
description: |
This endpoint's behavior is identical to the [Extract doc at your URL](ref:extract-from-url) endpoint's behavior, except that Sensible uses the specified config to extract data from the document instead of automatically choosing the best-scoring extraction in the document type.
parameters:
- $ref: '#/components/parameters/document_type'
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
- $ref: '#/components/parameters/config_name'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractFromUrlRequest'
tags:
- Document
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractFromUrlResponse'
description: Returns the ID to use to retrieve the extraction
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/generate_upload_url:
post:
operationId: generate-an-upload-url-for-a-pdf-portfolio
summary: Extract portfolio at a Sensible URL
description: |
Use this endpoint with multiple documents that are packaged into one file (a "portfolio"). For a list of supported file types, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
Segments a portfolio file into the specified document types (for example, 1099, w2, and bank_statement) and then runs extractions
asynchronously for each document Sensible finds in the portfolio. Take the following steps -
1. Use this endpoint to generate a Sensible URL.
2. PUT the document you want to extract data from at the URL, where `SENSIBLE_UPLOAD_URL` is the URL you received
from this endpoint's response. For more information about how to PUT the document, see the [generate_upload_url/{document_type}](ref:generate-upload-url) endpoint.
3. To retrieve the extraction, use a webhook, or use the extraction `id` returned in the response to poll the GET documents/{id} endpoint.
For more about extracting from portfolios, see [Multi-document extractions](https://sensible.mintlify.app/.app/layout-based-extractions/portfolio).
parameters:
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
content:
application/json:
schema:
type: object
properties:
webhook:
$ref: '#/components/schemas/Webhook'
types:
$ref: '#/components/schemas/DocumentTypeNames'
required:
- types
tags:
- Portfolio
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UploadPortfolioResponse'
description: Returns the upload_url at which to PUT the document for extraction
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/extract_from_url:
post:
operationId: provide-a-download-url-for-a-pdf-portfolio
summary: Extract portfolio at your URL
description: |
Use this endpoint with multiple documents that are packaged into one file (a "portfolio"). For a list of supported file types, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
Segments a portfolio file at the specified `document_url` into the specified document types (for example, 1099, w2, and bank_statement)
and then runs extractions asynchronously for each document Sensible finds in the portfolio. Take the following steps.
1. Run this endpoint.
3. To retrieve the extraction, use a webhook, or use the extraction `id` returned in the response to poll the GET documents/{id} endpoint.
For more about extracting from portfolios, see [Multi-document extractions](https://sensible.mintlify.app/.app/layout-based-extractions/portfolio).
parameters:
- $ref: '#/components/parameters/environment'
- $ref: '#/components/parameters/document_name'
requestBody:
content:
application/json:
schema:
type: object
properties:
document_url:
$ref: '#/components/schemas/DocumentUrl'
types:
$ref: '#/components/schemas/DocumentTypeNames'
webhook:
$ref: '#/components/schemas/Webhook'
required:
- types
- document_url
tags:
- Portfolio
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractFromUrlPortfolioResponse'
description: Returns the ID to use to retrieve the extraction.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'429':
$ref: '#/components/responses/429'
'500':
$ref: '#/components/responses/500'
/documents/{id}:
get:
operationId: retrieving-results
summary: Retrieve extraction by ID
description: |
Use this endpoint in conjunction with asynchronous extraction requests to retrieve your results.
You can also use this endpoint to retrieve the results for documents extractions from the synchronous /extract endpoint.
To poll extraction status, check the `status` field in this endpoint's response.
When the extraction completes, the returned status is `COMPLETE` and the response includes results in the
`parsed_document` field. For fields in the extraction for which Sensible couldn't find a value, Sensible returns null.
parameters:
- $ref: '#/components/parameters/id'
tags:
- Retrieve extractions
responses:
'200':
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/ExtractionSingleRetrievalResponse'
- $ref: '#/components/schemas/ExtractionPortfolioRetrievalResponse'
description: Returns the extraction.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'500':
$ref: '#/components/responses/500'
/extractions:
get:
operationId: list-extractions
summary: List extractions
tags:
- Retrieve extractions
description: |
Use this endpoint to get a filtered list of past extractions.
This endpoint returns a summary for each extraction, listed in reverse chronological order.
To get details about an extraction, use the [Retrieve extraction by ID](ref:retrieving-results) endpoint.
This endpoint uses keyset pagination to retrieve the next page of results.
By default it returns a first page of 20 extractions and an opaque `continuation_token` that you can pass in the next request to get the next page of results, until the endpoint returns `continuation_token` to indicate the last page.
Use the `limit` parameter to configure page size.
parameters:
- $ref: '#/components/parameters/start_date'
- $ref: '#/components/parameters/end_date'
- $ref: '#/components/parameters/page_limit'
- $ref: '#/components/parameters/continuation_token'
- $ref: '#/components/parameters/configuration_ids'
- $ref: '#/components/parameters/document_type_ids'
- $ref: '#/components/parameters/environments'
- $ref: '#/components/parameters/statuses'
- $ref: '#/components/parameters/min_coverage'
- $ref: '#/components/parameters/max_coverage'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/ExtractionsResponseFiltered'
description: Returns list of summarized extractions.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'500':
$ref: '#/components/responses/500'
/extractions/statistics:
get:
operationId: statistics
summary: Get extraction statistics
tags:
- Retrieve extractions
description: |
Returns daily extraction coverage statistics per config. Sensible returns coverage for each config that was used for at least one extraction performed in the production environment in the specified time period. For more information about coverage, see [Monitoring extractions](metrics).
parameters:
- $ref: '#/components/parameters/start_date_config'
- $ref: '#/components/parameters/end_date_config'
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/StatisticsResponse'
description: Returns daily statistics for configs in the specified time period.
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'500':
$ref: '#/components/responses/500'
/generate_excel/{ids}:
get:
operationId: get-excel-extraction
summary: Get Excel extraction
description: |
You can use this endpoint to get Excel files from documents, for example from PDFs. In more detail, this endpoint converts your JSON document extraction to an Excel spreadsheet.
To compile multiple documents into one Excel file, specify the IDs of their recent extractions in the request separated by commas, for example,
`/generate_excel/867514cc-fce7-40eb-8e9d-e6ec48cdac34,5093c65f-05bd-46a3-8df7-da3ed00f6d35`.
For the best compiled spreadsheet results, configure your SenseML so that the documents output identically named fields.
For more information about the conversion process, see [SenseML to spreadsheet reference](https://sensible.mintlify.app/.app/integrations/quick-extraction/excel-reference).
For portfolio extractions, Sensible returns an Excel file containing fields for all the documents it finds in the PDF. For more information, see [Multi-document spreadsheet](https://sensible.mintlify.app/.app/integrations/quick-extraction/excel-reference#multi-document-spreadsheet).
For a list of document file types that Sensible can extract data from, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
Call this endpoint after an extraction completes. For more information about checking extraction status,
see the `GET /documents/{id}` endpoint.
parameters:
- $ref: '#/components/parameters/ids'
tags:
- Get Excel from documents
responses:
'200':
description: |
Indicates the extraction successfully converted to an Excel file. This response contains the download URL for the Excel file. The link
expires after 15 minutes.
content:
application/json:
schema:
properties:
url:
type: string
format: url
description: The download URL for the Excel file
example: https://sensible-so-document-type-bucket-dev-us-west-2.s3.us-west-2.amazonaws.com/sensible/fc3484c5-3f35-4129-bb29-0ad1291ee9f8/EXTRACTION/14d82783-c12b-4e70-b0ae-ca1ce35a9836.xlsx?REDACTED
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'500':
$ref: '#/components/responses/500'
/generate_csv/{ids}:
get:
operationId: get-csv-extraction
summary: Get CSV extraction
description: |
You can use this endpoint to get CSV files from documents, for example, from PDFs. In more detail, this endpoint converts your JSON document extraction to a comma-separated values.
To compile multiple documents into one CSV file, specify the IDs of their recent extractions in the request separated by commas, for example,
`/generate_csv/867514cc-fce7-40eb-8e9d-e6ec48cdac34,5093c65f-05bd-46a3-8df7-da3ed00f6d35`.
For the best compiled spreadsheet results, configure your SenseML so that the documents output identically named fields.
For more information about the conversion process, see [SenseML to spreadsheet reference](https://sensible.mintlify.app/.app/integrations/quick-extraction/excel-reference).
For a list of document file types that Sensible can extract data from, see [Supported file types](https://sensible.mintlify.app/.app/senseml-reference/concepts/file-types).
Call this endpoint after an extraction completes. For more information about checking extraction status,
see the `GET /documents/{id}` endpoint.
parameters:
- $ref: '#/components/parameters/ids'
tags:
- Get Excel from documents
responses:
'200':
description: |
Indicates the extraction successfully converted to an CSV file. This response contains the download URL for the CSV file. The link
expires after 15 minutes.
content:
application/json:
schema:
properties:
url:
type: string
format: url
description: The download URL for the CSV file
example: https://sensible-so-document-type-bucket-dev-us-west-2.s3.us-west-2.amazonaws.com/sensible/fc3484c5-3f35-4129-bb29-0ad1291ee9f8/EXTRACTION/14d82783-c12b-4e70-b0ae-ca1ce35a9836.csv?REDACTED
'401':
$ref: '#/components/responses/401'
'400':
$ref: '#/components/responses/400'
'415':
$ref: '#/components/responses/415'
'500':
$ref: '#/components/responses/500'
components:
responses:
401:
description: Not authorized
content:
text/plain:
schema:
title: Unauthorized
type: string
example: Unauthorized
400:
description: Bad Request
content:
text/plain:
schema:
title: Bad Request
type: string
example: >-
Either a specific set of messages about fields in the request, or error messages like the following examples -
Not available to logged in users
To use the asynchronous flow you must have persistence enabled
Specified document type does not exist
Specified document type ${named type} does not exist
No published configurations found for environment ${environment}
Specified golden does not exist
Specified configuration/version does not exist
Specified configuration/version is not valid
Must provide the Content-Type header when request body is present
Content-Type must be application/json
Missing request body or body.document
Could not determine the content type of the document
Could not determine the content type of the document. Please check that the document was correctly encoded as Base64
This PDF is invalid. If you submitted this PDF using Base64 encoding, please check that the encoding is correct
This PDF is password protected. Please resubmit with password protection disabled
This PDF is empty
This PDF exceeds the maximum dimensions for OCR of 17 x 17 inches
This PDF exceeds the maximum size for OCR of 50MB
No fingerprints match for this PDF and fingerprint_mode is set to strict
Content type of ${found} does not match declared type of ${expected}
Document is not present
The start date must be before the end date
415:
description: Unsupported Media Type
content:
text/plain:
schema:
title: Unsupported Media Type
type: string
example: >-
One of the following error messages -
Content-Type must be application/json
Content-Type must be application/json or application/pdf or image/jpeg or image/png or image/tiff
429:
description: Too Many Requests
content:
text/plain:
schema:
title: Unsupported Media Type
type: string
example: >-
One of the following error messages -
Attempt limit exceeded, please retry after some time.
Free accounts are limited to 150 API calls per month. Please upgrade your account to make additional calls.
Pro accounts are limited to 5,000 API calls per month. Please upgrade your account to make additional calls.
500:
description: Internal Server Error
content:
text/plain:
schema:
title: Sensible encountered an unknown error
type: string
example: Sensible encountered an unknown error
parameters:
id:
name: id
required: true
in: path
description: Unique ID for the extraction, used to retrieve the extraction.
schema:
$ref: '#/components/schemas/ExtractionId'
ids:
name: ids
required: true
in: path
description: Comma-delimited list of unique extraction IDs.
schema:
$ref: '#/components/schemas/ExtractionId'
document_type:
name: document_type
required: true
in: path
description: |
Type of document to extract from. Create your custom type in the Sensible app (for example, `rate_confirmation`, `certificate_of_insurance`, or `home_inspection_report`).
To quickly test this endpoint using the `Try It` button in this interactive explorer, use the `senseml_basics` tutorial document type with this [example document](https://github.com/sensible-hq/sensible-docs/raw/main/readme-sync/assets/v0/pdfs/1_extract_your_first_data.pdf).
As a convenience, Sensible automatically detects the best-fit extraction from among the extraction queries ("configs") in the document type.
For example, if you create an `auto_insurance_quotes` document type, you can add `carrier 1`, `carrier 2`, and `carrier 3` configs
to the document type in the Sensible app. Then, you can extract data from all these carriers using the same document type, without specifying the carrier in the API request.
schema:
type: string
example: senseml_basics
config_name:
name: config_name
required: true
in: path
description: >-
User-friendly name of the config to use to extract data from the document.
schema:
type: string
example: anyco_insurance_auto_declarations
document_name:
name: document_name
in: query
description: >-
If you specify the filename of the document using this parameter, then Sensible returns the filename in the extraction response.
schema:
type: string
example: test.pdf
environment:
name: environment
in: query
description: >-
If you specify `development`, extracts preferentially using config versions
published to the development environment in the Sensible app. The extraction runs all configs in the doc type before
picking the best fit. For each config, falls back to production version if no development version of the config exists.
schema:
type: string
enum: [production, development]
default: production
start_date:
name: start_date
in: query
required: false
description: >-
Retrieves extractions with a `created` date that is equal to or later than this date-time.
The default is the unix epoch.
schema:
type: string
format: date-time
default: 1970-01-01T00:00:00Z
example: 2020-10-10T00:00:00.000Z
end_date:
name: end_date
in: query
required: false
description: >-
Retrieves extractions with a `created` date that is equal to or earlier than this date-time.
The default is the current date-time.
schema:
type: string
format: date-time
example: 2024-01-20T00:00:00.000Z
page_limit:
name: limit
in: query
required: false
description: >-
Use the limit to define the number of items you recieve on each page of the paginated response.
The default is 20.
schema:
type: number
default: 20
example: 100
continuation_token:
name: continuation_token
in: query
required: false
description: >-
Get the next page of results by making a new request and passing the opaque `continuation_token` parameter
that Sensible returns in the current page of responses.
Sensible returns a null `continuation_token` in the response to indicate the last page.
schema:
type: string
example: eyJpZCI6IjRiNTg1Mjc4LWUwOWMtNGJiOS04ODJiLThmYjFhZTA3ZGU3ZiIsInVzZXIiOiJjMDI0Y2QxYy01ZMMzLTRhODItYjJlYS0yYzgwN2U0NDk4OGIiLCJjcmVhdGVkIjoiMjAyNC0wNS0wMVQyMjo11Do1NS43MzMaIn1
start_date_config:
name: start_date
in: query
required: true
description: >-
Retrieves statistics for configs used in production on this day and later.
Sensible returns daily statistics, so if you specify a time in addition to a date, Sensible ignores the time.
schema:
type: string
format: date-time
example: 2020-10-10T00:00:00.000Z
end_date_config:
name: end_date
in: query
required: true
description: >-
Retrieves daily statistics for configs used in production on this day and earlier.
schema:
type: string
format: date-time
example: 2020-10-20T00:00:00.000Z
document_type_ids:
name: document_type_ids
in: query
description: >-
Comma-delimited list of document types by which to filter the retrieved extractions.
schema:
type: string
example: 4e95e3d0-8d69-49b0-9501-2cca8b902a45, 24d82783-b12b-4e70-b0ae-ca1ce35a9836
configuration_ids:
name: configuration_ids
in: query
description: >-
Comma-delimited list of configurations by which to filter the retrieved extractions.
schema:
type: string
example: 1417523c-f318-4037-90e9-ed7ade06031d,23be500b-4b7f-43dd-b0db-f06ec5c6c8de
statuses:
name: statuses
in: query
description: >-
Comma-delimited list of statuses (WAITING, PROCESSING, FAILED, COMPLETE) by which to filter the retrieved extractions.
schema:
type: string
example: COMPLETE, WAITING
min_coverage:
name: min_coverage
in: query
description: >-
Minimum extraction coverage score by which to filter the retrieved extractions. For more information about scoring, see [Monitoring extractions](https://sensible.mintlify.app/.app/best-practices/metrics).
schema:
type: number
example: 0.8
max_coverage:
name: max_coverage
in: query
description: >-
Maximum extraction coverage score by which to filter the retrieved extractions. For more information about scoring, see [Monitoring extractions](https://sensible.mintlify.app/.app/best-practices/metrics).
schema:
type: number
example: 1.0
environments:
name: environments
in: query
description: >-
Comma-delimited list of environments (PRODUCTION, DEVELOPMENT) by which to filter the retrieved extractions.
schema:
type: string
example: PRODUCTION,DEVELOPMENT
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: >-
Sensible uses API keys to authenticate requests.
Keep your API keys secure and do not share them publicly accessible areas such as GitHub, client-side code, etc.
Authentication to the API is performed via Bearer Authentication. Provide your API key as the bearer auth value.
schemas:
Coverage:
type: number
description: The coverage score measures how fully an extraction captured all your target data in the document. It's a percentage comparing non-null, [validated](https://sensible.mintlify.app/.app/best-practices/validate-extractions) fields to total fields returned by a config for a document. For example, a coverage score of 70% for an extraction with no validation errors means that 30% of fields were null. For more information about scoring, see [Monitoring extractions](https://sensible.mintlify.app/.app/best-practices/metrics).
example: 0.75
Environment:
type: string
description: >-
The environment in which the version of the config used to run the extraction was published.
example: DEVELOPMENT
ExtractionSingleResponse:
allOf:
- $ref: '#/components/schemas/ExtractionSingleBase'
- $ref: '#/components/schemas/ExtractionContent'
- type: object
properties:
completed:
$ref: '#/components/schemas/ExtractionCompleted'
classification_summary:
$ref: '#/components/schemas/ClassificationSummary'
page_count:
type: integer
example: 100
description: Total number of pages in the document.
environment:
$ref: '#/components/schemas/EnvironmentName'
document_name:
$ref: '#/components/schemas/DocName'