rocket How to Integrate an OCR Solution with GoFreight’s API to Digitize Invoice
In this guide, I’ll walk you through how to leverage GoFreight’s API to integrate an OCR solution that digitizes invoices from vendors. The goal is to use the OCR solution to extract key information from paper invoices, and then automate the entry of these digital invoices into GoFreight through the API.
Integration Steps
To successfully import an invoice into GoFreight, three key steps must be completed:
- Match the Invoice to the Corresponding Bill of Lading (B/L)
- Map the currency code on the invoice in GoFreight. (*If your GoFreight configuration is set to account by office, different offices can have different currencies configured.)
- Identify the Vendor’s Trade Partner Ref. ID in GoFreight
- Map Billing Codes from the Invoice to GoFreight Billing Codes
Once these four steps are complete, you’re ready to call the Create Invoice API to generate the invoice in GoFreight. This final API call will automatically register the digital invoice within the system, linking it to the correct B/L, vendor, and billing codes, and making it accessible for further processing or review.
1. Match the Invoice to the Corresponding Bill of Lading (B/L)
Each invoice needs to be associated with a specific Bill of Lading (B/L) within GoFreight. This requires matching the invoice to the correct BL reference ID. By identifying the appropriate Ref. ID, the system ensures that the invoice is correctly filed within GoFreight.
To associate the invoice with the correct Bill of Lading (B/L) in GoFreight, follow these detailed steps:
1. Extract B/L Number with OCR:
Use OCR to capture the Bill of Lading (B/L) number from the vendor’s invoice. These identifiers are essential for locating the correct shipment in GoFreight.
2. Call Get Shipment Master Bills, Get Shipment House Bills or List Container API:
- If the information provided on the invoice is MB/L No., call the Get Shipment Master Bills API, which will return the MB/L Ref.
- When you query the MB/L No. by API, you also need to know which shipment type this B/L belongs to (OI/OE/AI/AE).
- If the information provided on the invoice is HB/L No., call the Get Shipment House Bills API, which will return the MB/L Ref.
- If the information provided on the invoice is container No., call the List Containers API, which will return the MB/L Ref. or HB/L Ref. contains the container.
3. Retrieve the B/L Ref. ID if Found:
If the API successfully locates the B/L number or Container No., it will return the corresponding B/L Ref. ID. This ID is used to link the invoice to the correct B/L within GoFreight.
4. If No B/L Ref. ID is Found: If the API cannot locate the relevant B/L Ref. ID, take the following steps:
- Inform the User: Provide a user interface notifying the user that the invoice cannot be matched to a corresponding B/L.
- Verify OCR Results: The user may need to review and correct the OCR-extracted Container No. or B/L number to ensure accuracy.
- Check GoFreight for Existing B/Ls: Verify if the relevant B/L exists within GoFreight. If not, create the B/L data as necessary.
- Retry Matching: After adjustments, re-trigger the matching process.
5. If Multiple B/L Ref. IDs are Found:
If the API returns multiple possible B/L Ref. IDs, proceed as follows:
- Retrieve Complete B/L Details:
- Create an invoice API that supports creating an invoice under all shipment types in GoFreight. You may need to retrieve data from different shipment types in GoFreight.
- For Ocean Import shipments, use each B/L Ref. ID to call the Get Ocean Import MB/L by Ref. or Get Ocean Import HB/L by Ref. API, which provides full details of each B/L.
- For Ocean Export shipments, Get Ocean Export MB/L by Ref., Get Ocean Export HB/L by Ref.
- For Air Import shipments, call Get Air Import MAWB by Ref., Get Air Import HAWB by Ref.
- For Air Export shipments, call Get Air Export MAWB by Ref., Get Air Export HAWB by Ref.
- Narrow Down Matches: Use shipment details—such as date, shipper, customer, trucker, and carrier information—to identify the correct B/L.
- Provide a User Interface for Selection: Display all matching B/Ls to the user, allowing them to select the appropriate one.
- Finalize the Match: Once the user makes a selection, capture the selected B/L Ref. ID for further processing.
2. Map the currency code on the invoice in GoFreight.
Call the Get Currency Codes API to obtain the Currency Ref. and Currency Name.
Compare the Currency Name on the invoice with the GoFreight’s currency name, and then use the corresponding Currency Ref. to populate the Create Invoice’s currency ref field.
3. Identify the Vendor’s Trade Partner Ref. ID in GoFreight
The next step is to link the invoice to the vendor issuing it. GoFreight tracks vendors using a unique Trade Partner Ref. ID. This ID allows the system to recognize and properly assign the invoice to the correct vendor record.
To accurately identify and link the vendor on the invoice to the correct Trade Partner in GoFreight, please refer to the article Managing Trade Partners in GoFreight API Integration.
3. Map Billing Codes from the Invoice to GoFreight Billing Codes
The invoice likely contains various billing codes that need to be matched to GoFreight’s internal billing codes. This step involves finding the appropriate GoFreight Billing Code Ref. ID, ensuring that each line item is accurately represented. Please refer to the article How to Get GoFreight Billing Code Ref. then Match it with Vendor Invoices.
4. Call Create an AP Invoice API
Once you have obtained the necessary Ref. IDs—specifically the B/L Ref. ID, Billing Code Ref. IDs, Currency Ref. and Trade Partner Ref. ID—you are ready to proceed with creating the invoice in GoFreight.
Call the Create Invoice API:
Use the Create an Account Payable, Create an Account Receivable or Create a Debit/Credit Note to automatically generate the invoice in GoFreight. This API call will link the invoice to the appropriate Bill of Lading, Trade Partner, and Billing Codes, ensuring that the data is accurately organized within the system.
After completing this step, the invoice will be successfully created in GoFreight, ready for further processing or review. This automated approach enhances efficiency, reduces manual data entry, and ensures that the invoice information is correctly linked in GoFreight.