Skip to main content

Retrieve parsed document

Once a document has been parsed, it can be retrieved using a GET request with the request_id of the document.

Guide to implementing API#

API Endpoint#

GET https://api.documentpro.ai/files

Example implementation using Python#

import requests
# Your API keyapi_key = 'YOUR_API_KEY'
# The request ID of the document you want to retrieverequest_id = 'YOUR_REQUEST_ID'url = f"https://api.documentpro.ai/files?request_id={request_id}"
payload = {}headers = {  'x-api-key': api_key}
response = requests.request("GET", url, headers=headers, data=payload)
print(response)

Successfull response body#

Example response with status code 200

{    "request_id": "your-request-id",    "request_status": "completed",    "response_body": {        "file_name": "your-file-name",        "file_presigned_url": "temporary-url-to-your-file",        "user_error_msg": null,        "template_id": "your-template-id",        "template_type": "receipt",        "template_title": "Receipt",        "num_pages": 2,        "result_json_data": {}    },    "created_at": "2023-07-30T19:05:10.696893",    "updated_at": "2023-07-30T19:05:29.565249"}

A document can have the following request_status values:

StatusDescription
pendingThe document has not started the parsing process
processingThe document is being parsed
completedThe document has been parsed successfully
failedParsing failed due to an application or document error
exceptionParser failed. These are retryable requests

user_error_msg field will be populated for failed and exception status.

Error response body#

Example response with status code 400, 403, 404, 500

{    "success": false,    "error": "error message"}