Use the OCR engine
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. Note that the OCR engine is also separate from vendor enrichment: OCR extracts bill and invoice data from a PDF or image, while enrichment finds which payment methods a vendor accepts and their contact details.
Process the document
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.
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.
Upload a file
Upload a base64-encoded string
See the API reference for complete details about this endpoint.
Build the request
Make a POST request to /Import/ocrDocumentForm/{typeResult}, uploading the file. The OCR engine supports PDF, 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 -L 'https://api-sandbox.payabli.com/api/Import/ocrDocumentForm/bill' \-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \--form 'file=@"/C:/Users/accounting/Desktop/invoices/sample-bill.pdf"'
Copy the response
Save the resultData object from the response. In the next step, you use its values to build the request that creates the bill or invoice.
Expand for long code example
{"responseCode": 1,"pageIdentifier": null,"roomId": 0,"isSuccess": true,"responseText": "Success","responseData": {"resultData": {"billNumber": "INV-4021","netAmount": 886,"discount": null,"totalAmount": 956.88,"billDate": "2026-08-01T00:00:00Z","dueDate": "2026-08-31T00:00:00Z","comments": null,"billItems": [{"itemTotalAmount": 216,"itemTaxAmount": 0,"itemTaxRate": 0,"itemProductCode": null,"itemProductName": "Copper pipe 3/4in x 10ft","itemDescription": "","itemCommodityCode": null,"itemUnitOfMeasure": null,"itemCost": 18,"itemQty": 12,"itemMode": null,"itemCategories": []},{"itemTotalAmount": 100,"itemTaxAmount": 0,"itemTaxRate": 0,"itemProductCode": null,"itemProductName": "Pipe fittings, assorted","itemDescription": "","itemCommodityCode": null,"itemUnitOfMeasure": null,"itemCost": 2.5,"itemQty": 40,"itemMode": null,"itemCategories": []},{"itemTotalAmount": 570,"itemTaxAmount": 0,"itemTaxRate": 0,"itemProductCode": null,"itemProductName": "Install labor","itemDescription": "","itemCommodityCode": null,"itemUnitOfMeasure": "hrs","itemCost": 95,"itemQty": 6,"itemMode": null,"itemCategories": []}],"mode": 0,"accountingField1": null,"accountingField2": "VEJBB-65237","additionalData": {"category": "Job Supplies","currency_code": "USD","title": "INVOICE","type": "invoice","reference_number": "VEJBB-65237"},"vendor": {"vendorNumber": null,"name1": "Northwind Plumbing Supply","name2": "Northwind Plumbing Supply","ein": null,"phone": "(503) 555-0147","email": "accounts@northwindplumbing.example","remitEmail": null,"address1": "412 Cedar Street","address2": null,"city": "Portland","state": "OR","zip": "97201","country": null,"mcc": null,"locationCode": null,"contacts": null,"billingData": {"id": 0,"accountId": null,"nickname": "","bankName": "","routingAccount": "","accountNumber": "","typeAccount": "","bankAccountHolderName": "","bankAccountHolderType": "Business","bankAccountFunction": 0,"verified": false,"status": 0,"services": [],"default": false,"country": "US"},"paymentMethod": null,"vendorStatus": 1,"remitAddress1": null,"remitAddress2": null,"remitCity": null,"remitState": null,"remitZip": null,"remitCountry": null,"payeeName1": null,"payeeName2": null,"customerVendorAccount": "0041-88213","internalReferenceId": null,"customField1": null,"customField2": null,"additionalData": {},"defaultMethodId": null,"attachment": null},"endDate": null,"frequency": null,"terms": "Net 30","status": 0,"lotNumber": null,"attachments": [{"ftype": "pdf","filename": "sample-bill.pdf","fileDescriptor": null,"furl": null,"fContent": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXS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AooU3VidG90YWw6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICQ4ODYuMDApIFRqCjAgLTIwIFRkCihUYXggXCg4JVwpOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkNzAuODgpIFRqCjAgLTIwIFRkCihUb3RhbCBEdWU6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJDk1Ni44OCkgVGoKMCAtMjAgVGQKMCAtMjAgVGQKKFJlbWl0IHRvOiBOb3J0aHdpbmQgUGx1bWJpbmcgU3VwcGx5LCBBY2N0IDAwNDEtODgyMTMpIFRqCkVUCmVuZHN0cmVhbQplbmRvYmoKNSAwIG9iago8PCAvVHlwZSAvRm9udCAvU3VidHlwZSAvVHlwZTEgL0Jhc2VGb250IC9IZWx2ZXRpY2EgPj4KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI0MSAwMDAwMCBuIAowMDAwMDAxMzI3IDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKMTM5NwolJUVPRgo="}],"scheduledOptions": null},"rawData": {"account_number": "0041-88213","bill_to": {"address": null,"name": "Gruzya Adventure Outfitters","vat_number": null},"cashback": null,"category": "Job Supplies","created_date": "2026-10-01 14:08:07","currency_code": "USD","date": "2026-08-01 00:00:00","delivery_date": null,"discount": null,"document_reference_number": null,"document_title": "INVOICE","document_type": "invoice","due_date": "2026-08-31","duplicate_of": null,"external_id": null,"guest_count": null,"id": 509165237,"img_file_name": "509165237.pdf","insurance": null,"invoice_number": "INV-4021","is_approved": null,"is_duplicate": false,"lat": null,"line_items": [{"category": null,"date": null,"description": "Copper pipe 3/4in x 10ft","discount": null,"discount_rate": null,"end_date": null,"full_description": "Copper pipe 3/4in x 10ft","hsn": null,"id": null,"order": 0,"price": 18,"quantity": 12,"reference": null,"section": null,"sku": null,"start_date": null,"tags": [],"tax": null,"tax_rate": null,"text": "Copper pipe 3/4in x 10ft\t12 $18.00 $216.00","total": 216,"type": "product","unit_of_measure": null,"upc": null,"weight": null},{"category": null,"date": null,"description": "Pipe fittings, assorted","discount": null,"discount_rate": null,"end_date": null,"full_description": "Pipe fittings, assorted","hsn": null,"id": null,"order": 1,"price": 2.5,"quantity": 40,"reference": null,"section": null,"sku": null,"start_date": null,"tags": [],"tax": null,"tax_rate": null,"text": "Pipe fittings, assorted\t40 $2.50 $100.00","total": 100,"type": "product","unit_of_measure": null,"upc": null,"weight": null},{"category": null,"date": null,"description": "Install labor","discount": null,"discount_rate": null,"end_date": null,"full_description": "Install labor","hsn": null,"id": null,"order": 2,"price": 95,"quantity": 6,"reference": null,"section": null,"sku": null,"start_date": null,"tags": [],"tax": null,"tax_rate": null,"text": "Install labor\t6 hrs $95.00 $570.00","total": 570,"type": "service","unit_of_measure": "hrs","upc": null,"weight": null}],"lng": null,"notes": null,"ocr_text": "INVOICE\nNorthwind Plumbing Supply\n412 Cedar Street, Portland, OR 97201\naccounts@northwindplumbing.example\t•\t(503) 555-0147\n\nBill To: Gruzya Adventure Outfitters\nInvoice Number: INV-4021\nInvoice Date: 2026-08-01\tDue Date: 2026-08-31\nTerms: Net 30\n\nDescription\tQty Unit Amount\nCopper pipe 3/4in x 10ft\t12 $18.00 $216.00\nPipe fittings, assorted\t40 $2.50 $100.00\nInstall labor\t6 hrs $95.00 $570.00\n\nSubtotal:\t\t\t$886.00\nTax (8%):\t\t\t$70.88\nTotal Due:\t\t\t$956.88\n\nRemit to: Northwind Plumbing Supply, Acct 0041-88213","order_date": null,"payment": {"terms": "Net 30","card_number": null,"display_name": null,"type": null},"purchase_order_number": null,"rounding": null,"reference_number": "VEJBB-65237","server_name": null,"service_end_date": null,"service_start_date": null,"ship_date": null,"ship_to": {"address": null,"name": null,"vat_number": null},"shipping": null,"status": null,"store_number": null,"subtotal": 886,"tax": 70.88,"tax_lines": [{"base": null,"name": null,"rate": 8,"total": 70.88}],"timezone_offset": null,"tip": null,"total": 956.88,"total_weight": null,"tracking_number": null,"updated_date": "2026-10-01 14:08:08","vendor": {"types": null,"abn_number": null,"account_number": null,"address": "412 Cedar Street, Portland, OR 97201","bank_name": null,"bank_number": null,"bank_swift": null,"category": null,"email": "accounts@northwindplumbing.example","external_id": null,"fax_number": null,"iban": null,"name": "Northwind Plumbing Supply","phone_number": "(503) 555-0147","parsed_address": {"city": "Portland","country": null,"postcode": "97201","state": "OR","street_address": "412 Cedar Street"},"raw_name": "Northwind Plumbing Supply","reg_number": null,"type": null,"vat_number": null,"web": null},"weights": null}}}
Create the bill or invoice
After you get the OCR results, use the values in the resultData object to create a bill or invoice in Payabli.
Create an invoice
Create a bill
Follow these steps to create an invoice (money in).
See the API reference for complete details about this endpoint.
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.
Expand for long code example
curl -L 'https://api-sandbox.payabli.com/api/Invoice/8cfec329267?forceCustomerCreation=false'-H 'Content-Type: application/json' \-H 'Accept: application/json' \-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \-d '{"customerData": {"customerId": 0,"firstName": "Bill Franks","lastName": null,"company": "","customerNumber": null,"billingAddress1": null,"billingAddress2": null,"billingCity": null,"billingState": null,"billingZip": null,"billingCountry": null,"billingPhone": null,"billingEmail": null,"shippingAddress1": "Durango, CO 81301","shippingAddress2": null,"shippingCity": null,"shippingState": null,"shippingZip": null,"shippingCountry": null,"additionalData": {},"identifierFields": null},"invoiceData": {"invoiceNumber": "6654477","invoiceDate": "2024-02-01 00:00:00","invoiceDueDate": "2024-02-01","invoiceEndDate": null,"invoiceStatus": 0,"invoiceType": 0,"frequency": null,"paymentTerms": "-","termsConditions": null,"notes": null,"tax": 0.21,"discount": null,"invoiceAmount": 3000.21,"freightAmount": null,"dutyAmount": null,"purchaseOrder": null,"firstName": "Bill Franks","lastName": null,"company": "","shippingAddress1": "Durango, CO 81301","shippingAddress2": null,"shippingCity": null,"shippingState": null,"shippingZip": null,"shippingCountry": null,"shippingEmail": null,"shippingPhone": null,"shippingFromZip": null,"summaryCommodityCode": null,"items": [{"itemTotalAmount": 3000.0,"itemTaxAmount": 0,"itemTaxRate": 0,"itemProductCode": null,"itemProductName": "Paper Airplane Stock","itemDescription": "","itemCommodityCode": null,"itemUnitOfMeasure": null,"itemCost": 3.0,"itemQty": 1000,"itemMode": null,"itemCategories": []}],"attachments": [{"ftype": "pdf","filename": "paulsPaper_sample Invoice.pdf","fileDescriptor": null,"furl": null,"fContent": "JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQogICAvQ29udGVudHMgNCAwIFIgL1Jlc291cmNlcyA8PCAvRm9udCA8PCAvRjEgNSAwIFIgPj4gPj4gPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCAzMzggPj4Kc3RyZWFtCkJUCi9GMSAxNiBUZiA1MCA3NDAgVGQgKElOVk9JQ0UpIFRqCi9GMSAxMCBUZiA1MCA3MTAgVGQgKEludm9pY2UgTm8uIDY2NTQ0NzcpIFRqCjUwIDY5NSBUZCAoRGF0ZTogMi8xLzIwMjQpIFRqCjUwIDY2NSBUZCAoRnJvbTogUGF1bCdzIFBhcGVyIFN1cHBseSkgVGoKNTAgNjUwIFRkICgxMjMgTm9ydGggMXN0IFN0LCBEdXJhbmdvLCBDTyA4MTMwMSkgVGoKNTAgNjIwIFRkIChUbzogQmlsbCBGcmFua3MpIFRqCjUwIDYwNSBUZCAoNTI1IEFuaW1hcyBWaWV3IERyaXZlLCBEdXJhbmdvLCBDTyA4MTMwMSkgVGoKNTAgNTc1IFRkIChJdGVtOiBBNCBQYXBlciB4IDEwMCkgVGoKNTAgNTYwIFRkIChBbW91bnQ6ICQyNTAuMDApIFRqCkVUCmVuZHN0cmVhbQplbmRvYmoKNSAwIG9iago8PCAvVHlwZSAvRm9udCAvU3VidHlwZSAvVHlwZTEgL0Jhc2VGb250IC9IZWx2ZXRpY2EgPj4KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDI2NiAwMDAwMCBuIAowMDAwMDAwNjU2IDAwMDAwIG4gCnRyYWlsZXIKPDwgL1NpemUgNiAvUm9vdCAxIDAgUiA+PgpzdGFydHhyZWYKNzMzCiUlRU9G"}],"additionalData": {"category": "Job Supplies","currency_code": "USD","type": "invoice","reference_number": "VBGIJ-80131"}},"scheduledOptions": null}
Read the results
If your request was successful, you’ll receive a success response with the new invoice’s ID in responseData.
{"isSuccess": true,"responseText": "Success","responseCode": 1,"responseData": 816,"pageidentifier": null,}
Related resources
See these related resources to help you get the most out of Payabli.
Related topics
- Manage bills with the API - Learn how to add and manage bills for vendors via the API
- Manage invoices with the API - Learn how to create, update, delete, and send invoices with the Payabli API