Run results endpoint (Deprecated)

The Get run results endpoint offers a simpler way to get the results of an app run. This page remains temporarily available for reference but is not actively maintained.

Access app run results by sending a POST request to URL_BASE/api/v1/flow_binary/results with the request body encoded as JSON.

MethodSyntax
POSTURL_BASE/api/v1/flow_binary/results

Request parameters

Parameters are required unless marked as optional.

ParameterTypeDescriptionValues
ibresults_pathstringThe path to a batch.ibflowresults file
optionsDictOptional. JSON dictionary with options to return additional metadata.include_checkpoint_results, provenance_info, include_page_layouts
include_page_layoutsBooleanOptional. Whether to include page_layout information about the original input document.Defaults to false.
include_checkpoint_resultsBooleanOptional. Whether to include validation information in the response.Defaults to false.
refined_phrases_featuresList[string]Experimental for AI Hub. Optional. Include entry 'provenance info' in list to include extracted word position information.
internal_keysBooleanOptional. Include hidden fields (i.e. fields with field names that start with __)
file_offsetintegerOptional (defaults to 0). Initial file index to start returning results from. Use this when dealing with large results that are paginated and exceed the default limit of 20 that is returned by the API.Integer specifying a file index. Defaults to 0.

Response schema

Not all keys are returned in the response by default. Some are gated on the options passed in through the request.

KeyTypeDescriptionValue
recordsArrayArray of all the results by records
record/output_file_pathstringThe output ibdoc the record was retrieved from
record/resultsArrayThe set of extracted phrases by field names
record/results/keystringfield key. An internal field has __ (double underscore) as a prefix
record/results/valuestringfield value. If the field results has an error value is “ERROR”
record/results/field_typestringfield type. Extracted type of the field. Must be one of the following: ANY, TEXT, INT, FLOAT, DICT, LIST, BOOL, TABLE, IMG, EXTRACTED_TABLE, EXTRACTED_TABLE_LIST, SELECT
record/results/provenanceDictSource metadata on extracted value location
record/results/model_confidencefloatAverage model confidence for the extracted value
record/results/ocr_confidencefloatAverage OCR confidence for the extracted value
record/results/information_regionsListList of bounding boxes in the pixel space of what anchor information was used to extract the field
record/results/information_text_regionsListList of bounding boxes in the OCR text space of what anchor information was used to extract the field
record/results/extracted_regionsListList of bounding boxes in the pixel space of where the extracted value is on the document
record/results/extracted_text_regionsListList of bounding boxes in the OCR text space of where the extracted value is on the document
record/results/error_msgstringError message - only exists when value is ERROR.
record/record_indexintegerRecord index in output path.
record/file_namestringName of the original document.
record/is_manually_reviewedstringIf the record is manually marked as reviewed
record/checkpoint_resultsDictThe full path to the root output folder.A string showing the output folder path.
record/checkpoint_results/flow_path_in_binarystringPath to the binary
record/checkpoint_results/record_indexintegerRecord index of the checkpoint result
record/checkpoint_results/resultsDictThe full path to the root output folder.A string showing the output folder path.
record/checkpoint_results/results/validBooleanIf the validation function passed
record/checkpoint_results/results/fieldsArrayArray of all fields passed to this validation function
record/checkpoint_results/results/msgstringValidation message
record/checkpoint_results/results/typestringType of validation done.‘extraction-custom’, ‘classification_custom’, ‘typecheck’
record/layoutDictPage metadata and information
record/layout/page_layoutsArrayList of page layouts
record/layout/page_layouts/page_numberintegerPage number
record/layout/page_layouts/processed_image_pathstringImage path to the generated image
record/layout/page_layouts/widthintegerWidth of image
record/layout/page_layouts/heightintegerHeight of image
record/layout/page_layouts/corrected_rotationintegerRotation angle of document
record/layout/page_layouts/is_image_pageBooleanWhether the page is an image
record/layout/page_layouts/origin_posArrayOriginal position of the document
record/layout/page_layouts/origin_pos/xintegerx coordinate
record/layout/page_layouts/origin_pos/yintegery coordinate
record/layout/document_pathstringPath to the original document
record/errorDictOnly if a record fails
record/error/error_messagestringError message for the record.
record/error/error_typestringError type
record/error/step_namestringFlow step where error occurred

Examples

Request

Example (Python):

1url = url_base + '/api/v1/flow_binary/results'
2
3args = {
4 'ibresults_path': "/jaydoe/my_repo/fs/Instabase Drive/flow_proj/out/batch.ibflowresults",
5 'options': {
6 'refined_phrases_features': ['provenance_info'],
7 'include_page_layouts': True,
8 },
9 'file_offset': 0
10}
11json_data = json.dumps(args)
12
13headers = {
14 'Authorization': 'Bearer {0}'.format(token)
15}
16
17r = requests.post(url, data=json_data, headers=headers)
18resp_data = json.loads(r.content)

Full Pagination Example (Python):

1url = url_base + '/api/v1/flow_binary/results'
2
3args = {
4 'ibresults_path': "/jaydoe/my_repo/fs/Instabase Drive/flow_proj/out/batch.ibflowresults",
5 'options': {
6 'refined_phrases_features': ['provenance_info'],
7 'include_page_layouts': True,
8 },
9 'file_offset': 0
10}
11json_data = json.dumps(args)
12
13headers = {
14 'Authorization': 'Bearer {0}'.format(token)
15}
16
17r = requests.post(url, data=json_data, headers=headers)
18resp_data = json.loads(r.content)
19
20# Parse through pages until no more pages left to look through
21all_records = [resp_data.get('records', [])]
22while len(resp_data) > 0:
23 # Retrieve the last file_index from the last record returned
24 next_file_offset = resp_data['records'][-1]['file_index'] + 1
25 args['file_offset'] = next_file_offset
26 json_data = json.dumps(args)
27
28 r = requests.post(url, data=json_data, headers=headers)
29 resp_data = json.loads(r.content)
30 resp_records = resp_data.get('records', [])
31
32 all_records.extend(resp_records)

Response

The response body is a JSON object.

If successful:

1HTTP STATUS CODE 200
2
3{
4 records: [
5 {
6 "output_file_path": "path/to/my/output.ibdoc",
7 "results": [
8 {
9 "key": "field1",
10 "value": "value1",
11 "model_confidence": 0.43
12 }...,
13 {
14 "key": "field2",
15 "value": "ERROR",
16 "error_msg": "Some error happened (line: 120)",
17 "ocr_confidence": 0.98
18 },
19 {
20 "key": "__hidden_field3",
21 "value": "value3"
22 },
23 ],
24 "record_index": 0,
25 "file_name": "document.pdf",
26 "layout": {
27 "page_layouts": [
28 {
29 "page_number": 0,
30 "processed_image_path": "path/to/generated/image",
31 "width": 600,
32 "height": 800,
33 "corrected_rotation": 0,
34 "is_image_page": false,
35 "origin_pos": {
36 "x": 0.0,
37 "y": 0.0
38 }
39 }..., //more pages
40 ]
41 },
42 "document_path": "path/to/my/original/document.pdf"
43 },
44 {
45 "error": {
46 "error_message": "Columns failed: field1",
47 "error_type": "process_files_failed",
48 "step_name": "process_files"
49 },
50 "file_name": "error.pdf"
51 }..., // more records
52 ]
53}
Was this page helpful?