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.
Method | Syntax |
---|---|
POST | URL_BASE/api/v1/flow_binary/results |
Request parameters
Parameters are required unless marked as optional.
Parameter | Type | Description | Values |
---|---|---|---|
ibresults_path | string | The path to a batch.ibflowresults file | |
options | Dict | Optional. JSON dictionary with options to return additional metadata. | include_checkpoint_results , provenance_info , include_page_layouts |
include_page_layouts | Boolean | Optional. Whether to include page_layout information about the original input document. | Defaults to false . |
include_checkpoint_results | Boolean | Optional. Whether to include validation information in the response. | Defaults to false . |
refined_phrases_features | List[string] | Experimental for AI Hub. Optional. Include entry 'provenance info' in list to include extracted word position information. | |
internal_keys | Boolean | Optional. Include hidden fields (i.e. fields with field names that start with __ ) | |
file_offset | integer | Optional (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.
Key | Type | Description | Value |
---|---|---|---|
records | Array | Array of all the results by records | |
record/output_file_path | string | The output ibdoc the record was retrieved from | |
record/results | Array | The set of extracted phrases by field names | |
record/results/key | string | field key. An internal field has __ (double underscore) as a prefix | |
record/results/value | string | field value. If the field results has an error value is “ERROR” | |
record/results/field_type | string | field 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/provenance | Dict | Source metadata on extracted value location | |
record/results/model_confidence | float | Average model confidence for the extracted value | |
record/results/ocr_confidence | float | Average OCR confidence for the extracted value | |
record/results/information_regions | List | List of bounding boxes in the pixel space of what anchor information was used to extract the field | |
record/results/information_text_regions | List | List of bounding boxes in the OCR text space of what anchor information was used to extract the field | |
record/results/extracted_regions | List | List of bounding boxes in the pixel space of where the extracted value is on the document | |
record/results/extracted_text_regions | List | List of bounding boxes in the OCR text space of where the extracted value is on the document | |
record/results/error_msg | string | Error message - only exists when value is ERROR . | |
record/record_index | integer | Record index in output path. | |
record/file_name | string | Name of the original document. | |
record/is_manually_reviewed | string | If the record is manually marked as reviewed | |
record/checkpoint_results | Dict | The full path to the root output folder. | A string showing the output folder path. |
record/checkpoint_results/flow_path_in_binary | string | Path to the binary | |
record/checkpoint_results/record_index | integer | Record index of the checkpoint result | |
record/checkpoint_results/results | Dict | The full path to the root output folder. | A string showing the output folder path. |
record/checkpoint_results/results/valid | Boolean | If the validation function passed | |
record/checkpoint_results/results/fields | Array | Array of all fields passed to this validation function | |
record/checkpoint_results/results/msg | string | Validation message | |
record/checkpoint_results/results/type | string | Type of validation done. | ‘extraction-custom’, ‘classification_custom’, ‘typecheck’ |
record/layout | Dict | Page metadata and information | |
record/layout/page_layouts | Array | List of page layouts | |
record/layout/page_layouts/page_number | integer | Page number | |
record/layout/page_layouts/processed_image_path | string | Image path to the generated image | |
record/layout/page_layouts/width | integer | Width of image | |
record/layout/page_layouts/height | integer | Height of image | |
record/layout/page_layouts/corrected_rotation | integer | Rotation angle of document | |
record/layout/page_layouts/is_image_page | Boolean | Whether the page is an image | |
record/layout/page_layouts/origin_pos | Array | Original position of the document | |
record/layout/page_layouts/origin_pos/x | integer | x coordinate | |
record/layout/page_layouts/origin_pos/y | integer | y coordinate | |
record/layout/document_path | string | Path to the original document | |
record/error | Dict | Only if a record fails | |
record/error/error_message | string | Error message for the record. | |
record/error/error_type | string | Error type | |
record/error/step_name | string | Flow step where error occurred |
Examples
Request
Example (Python):
1 url = url_base + '/api/v1/flow_binary/results' 2 3 args = { 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 } 11 json_data = json.dumps(args) 12 13 headers = { 14 'Authorization': 'Bearer {0}'.format(token) 15 } 16 17 r = requests.post(url, data=json_data, headers=headers) 18 resp_data = json.loads(r.content)
Full Pagination Example (Python):
1 url = url_base + '/api/v1/flow_binary/results' 2 3 args = { 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 } 11 json_data = json.dumps(args) 12 13 headers = { 14 'Authorization': 'Bearer {0}'.format(token) 15 } 16 17 r = requests.post(url, data=json_data, headers=headers) 18 resp_data = json.loads(r.content) 19 20 # Parse through pages until no more pages left to look through 21 all_records = [resp_data.get('records', [])] 22 while 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:
1 HTTP 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 }