Use Payabli’s OCR (Optical Character Recognition) engine to recognize and scrape text from bills and invoices directly from your PDF or image files, simplifying your data management. You can then use the OCR engine’s output to add new invoices and bills in Payabli via the API.

If you need help understanding the difference between invoices and bills, see this resource.

Process the document

The first step is to choose whether you need to process an image file or a base64-encoded string version of your bill or invoice.

Before you begin, note that the bill and invoice typeResult values return the information needed to create the specified kind of record in Payabli, so make sure you choose the right one. You can’t use a bill typeResult OCR output to import an invoice, and vice versa.

See the API reference for complete details about this endpoint.

1

Build the request

Make a POST request to /Import/ocrDocumentForm/{typeResult}, uploading the file. The OCR engine supports pdf, jpg, jpeg, png, and gif files.

This example is for a bill, notice that the typeResult path parameter is bill. If you want to OCR an invoice for a customer, this value should be invoice.

curl --location 'https://api-sandbox.payabli.com/api/Import/ocrDocumentForm/bill' \
  --header 'requestToken: <API TOKEN>' \
  --form 'file=@"/C:/Users/accounting/Desktop/invoices/paulsPaper_invoice.pdf"'
2

Copy the response

Copy the content inside the resultData object. This content makes up the body of the add bill or add invoice request you make in the next step.

Create the bill or invoice

After you get the OCR results, you can use the API to create a bill or invoice in Payabli. You’ll need the contents of the resultData object returned in with the OCR response.

Follow these steps to create an invoice (money in).

See the API reference for complete details about this endpoint.

1

Build the request

Make a POST request to /Invoice/{entry}, adding the content you copied from the resultData object from the OCR response. The resultData contents is the body of the request.

2

Read the results

If your request was successful, you’ll recieve a success response with the new invoice’s ID in responseData.

{
  "isSuccess": true,
  "responseText": "Success",
  "responseCode": 1,
  "responseData": 816,
  "pageidentifier": null,
}

Was this page helpful?