API Documentation

Start a new conversion

The function recognizes (OCR) data in a file specified in the InputFile parameter and returns a converted file in a form of structured data in a format specified in the OutputFileFormat parameter.

Issue a following POST request, To start recognizing data in a file:

POST
https://converttodata.com/
converttodata/hs/api/v1/convert
Usage example:
curl -i -X POST -d curl -i -X POST -d '{"apikey": "_YOUR_API_KEY_", "inputfile":"http://google.com/", "outputfileformat":"json"}' https://converttodata.com/converttodata
/hs/api/v1/convert

Parameter

Field Type Description
ApiKey String Your API Key. (Required)
InputFile String URL of the input file (if input=url), or file content (if input = raw/base64). (Required)
OutputFileFormat String Output format, to which the file should be converted to. Available values:
- json;
- xml;
- csv;
- xlsx.
Default "json".

Return SUCCESS

Field Type Description
AvailableFiles String Conversion API credits available on balance.
FileName String Original file name.
IsError Boolean Error flag during conversion.
Returns True if there were errors, otherwise False.
ErrorReason String Contains error description if parameter IsError = True.
Rows String Recognized data from a file.
Success Response (example) (OutputFileFormat = "json" or not specified):
HTTP/1.1 200 OK { "AvailableFiles": 1000, "FileName": "MYTEST.pdf", "IsError": "False", "ErrorReason": "", "Rows": [ {"Description": "product 1", "Count": 2 "Price": 50 "Total": 100 } {"Description": "product 2", "Count": 3 "Price": 30 "Total": 90} ] }
Error Response (example) (OutputFileFormat = "json" or not specified):
HTTP/1.1 500 Invalid request { "AvailableFiles": 0, "IsError": "true", "ErrorReason": "Error: Invalid request", }

Send data recognition (OCR) parameters

Use this request to send data recognition (OCR) parameters. A submitted parameters will be used for all new conversions. A request returns information on the current conversion service parameters configured for the specified user (determined by the ApiKey), including into account an adjustment of their results in this request.

Issue a following POST request to change an OCR process setting:

POST
https://converttodata.com/converttodata
/hs/api/activeoptions
Usage example:
curl -i -X POST -d curl -i -X POST -d '{"ApiKey": "_YOUR_API_KEY_", "SetDefault":"false", "OutputFileFormat":"json", "Language":"eng,fra", "ResultAsFile: "false", "DeleteCharInNum":"true", "DeleteCharInID":"true", "DeleteNullRows": "true", "CorrectColOffset": "true"}' https://converttodata.com/converttodata
/hs/api/activeoptions

Parameter

Field Type Description
ApiKey String Your API Key (Required).
SetDefault Boolean Set default options. Default "true"
OutputFileFormat String Output format, to which the file should be converted to. Available values:
- json;
- xml;
- csv;
- xlsx.
Default "json".
Language String Language for recognizing data in the file. If you need to install several languages, list them separated by “,”. The more languages are specified, the slower the conversion process is. Default "eng".

Return SUCCESS

Field Type Description
AvailableFiles String Conversion API credits available on balance.
FileName String Original file name.
IsError Boolean Error flag during conversion.
Returns True if there were errors, otherwise False.
ErrorReason String Contains error description if parameter IsError = True.
Rows String Recognized data from a file.
Success Response (example) (OutputFileFormat = "json" or not specified):
HTTP/1.1 200 OK { "AvailableFiles": 1000, "FileName": "MYTEST.pdf", "IsError": "False", "ErrorReason": "", "Rows": [ {"Description": "product 1", "Count": 2 "Price": 50 "Total": 100 } {"Description": "product 2", "Count": 3 "Price": 30 "Total": 90} ] }
Error Response (example) (OutputFileFormat = "json" or not specified):
HTTP/1.1 500 Invalid request { "AvailableFiles": 0, "IsError": "true", "ErrorReason": "Error: Invalid request", }

Balance request and conversion history

Use this request to retrieve the current number of conversion credits available to the user identified by ApiKey. The response can also include information about recently processed files.

Issue the following POST request:

POST
https://converttodata.com/converttodata
/hs/api/conversionlog
Usage example:
curl -i -X POST -H "Content-Type: application/json" -d '{"ApiKey": "_YOUR_API_KEY_", "RecFilesNum": 10}' https://converttodata.com/converttodata
/hs/api/conversionlog

Parameters

Field Type Description
ApiKey String Your API key. Required.
RecFilesNum Number Number of the most recently processed files to include. Optional. Values greater than 500 are limited to 500.

Successful response

Field Type Description
AvailableFiles Number Current number of conversion credits available on the user's balance.
ProcessedFile Array Recently processed files. Each object contains the fields recorded in the user's conversion log.
Success response example:
HTTP/1.1 200 OK { "AvailableFiles": 35, "ProcessedFile": [] }
Error response example:
HTTP/1.1 500 Invalid request { "AvailableFiles": 0, "IsError": true, "ErrorReason": "Error: Invalid parameter: APIKey (user not found)" }