REST API

Before you start using REST API, you must get your username and secret key.

Upload Document

Curl

curl -F "document=@path/file.tif" -F "key=secret_key" https://datacapture.io/api/username/document/upload/

Python

import requests, json
with open('path/file.tif', 'rb') as f:
    r = requests.post("https://datacapture.io/api/username/document/upload/",
        data={'key': 'secret_key'},
        files={'document': ('file.tif', f)})
if r.status_code == 200:
    data = json.loads(r.text)
    for key, value in data.items():
        print(key, value)

Return Value

JSON string with the following fields:

  • error_code
  • document_id

Get Extracted Data and Status

Curl

curl -F "key=secret_key" https://datacapture.io/api/username/document/get/document_id

Python

import requests, json
r = requests.post("https://datacapture.io/api/username/document/get/document_id",
    data={'key': 'secret_key'})
if r.status_code == 200:
    data = json.loads(r.text)
    for key, value in data.items():
        print(key, value)

Return Value

JSON string with the following fields:

  • error_code
  • status_code
  • extracted_text
  • text_blocks

Delete Document

Curl

curl -F "key=secret_key" https://datacapture.io/api/username/document/delete/document_id

Python

import requests, json
r = requests.post("https://datacapture.io/api/username/document/delete/document_id",
    data={'key': 'secret_key'})
if r.status_code == 200:
    data = json.loads(r.text)
    for key, value in data.items():
        print(key, value)

Return Value

JSON string with the following fields:

  • error_code

Error Codes

Error Description
0 OK
1 Invalid image size or format
2 Invalid username or secret key
3 Document not found
4 Inactive upload credit

Status Codes

Status Description
0 OK
1 Queued / Processing
2 Failed
Cookies disclaimer

Our site saves small pieces of text information (cookies) on your device in order to deliver better content and for statistical purposes. You can disable the usage of cookies by changing the settings of your browser. By browsing our website without changing the browser settings you grant us permission to store that information on your device.

I agree Privacy Policy