Getting started: invoices processing via API

Create an account

In order to interact with the API, you need an account. If you have not created an account yet, do so via the ABBYY FlexiCapture Cloud web portal.

Get the authorization header

All requests to the API must contain an authorization header. To get the authorization header:

  1. Concatenate the application ID and the token using a colon as a separator (find the application ID and the token on the Applications page in the ABBYY FlexiCapture Cloud web portal).
  2. Encode the resulting string using any variant of Base64.
  3. Add the authorization method followed by a space in front of the string from step 2.

Example

Upload a file

Upload a file to the server. You will get the file's identifier and token in the response. The identifier and token will be used in all subsequent requests concerning this file.

curl -X POST --header "Accept: application/json" --header "Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l" "https://api-{location-id}.flexicapture.com/v2/file" --form "file=@/path/to/file/Letter.tif"

Supported location-ids: us: USA and Canada, au: Australia, eu: The European Union countries.

Start a task

After your document has been uploaded, start a task to begin the data extraction. You can specify multiple files in this request. The request may contain the following optional parameters: invoice region, verification type, and the export format for the results. The response will contain a task identifier.

curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l" -d "{

 \"properties\": {

   \"region\": \"US\",

   \"export_format\": \"Xls\",

   \"verification_type\": \"NoVerification\",

 },

 \"files\": [

   {

     \"id\": \"5ea16ff21b777315586713bf\",

     \"token\": \"34FB84AA68684F0F2BF496045224EB6C436F596B\"

   }

 ]

}" "https://api-{location-id}.flexicapture.com/v2/task/capture/invoices"

Supported location-ids: us: USA and Canada, au: Australia, eu: The European Union countries.

Get request status

Processing the task will take some time, so the extracted data will not be available immediately. You can check the task status using the identifier you have received when starting the task. Wait until the status changes to Done.

curl -X GET --header "Accept: application/json" --header "Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l" "https://api-{location-id}.flexicapture.com/v2/task/5ea18adc220e0d1c58177c59"

Supported location-ids: us: USA and Canada, au: Australia, eu: The European Union countries.

Download result

After the status of the task has changed to Done, you can download the output files using their identifiers and tokens. This request can be repeated for each input file in the task request.

curl -X GET --header "Accept: application/json" --header "Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l=" "https://api-{location-id}.flexicapture.com/v2/file/5ea21f6b7a9ae6193831d671/D188E5EFC0042A83529899AC1E1D94400A25DCF6"

Supported location-ids: us: USA and Canada, au: Australia, eu: The European Union countries.

Delete task

After downloading the output data, delete the task to remove all input and output files.

curl -X DELETE --header "Accept: application/json" --header "Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l=" "https://api-{location-id}.flexicapture.com/v2/task/5ea18adc220e0d1c58177c59"

Supported location-ids: us: USA and Canada, au: Australia, eu: The European Union countries.

9/15/2020 9:42:43 AM


Please leave your feedback about this article