veryfi is a Java module for communicating with the Veryfi OCR API
Install from Maven, a package manager for Java.
Install the package using Maven:
<dependency>
<groupId>com.veryfi</groupId>
<artifactId>veryfi-java</artifactId>
<version>2.1.2</version>
</dependency>Install the package using Gradle:
implementation group: 'com.veryfi', name: 'veryfi-java', version: '2.1.2'If you don't have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/
The veryfi library can be used to communicate with Veryfi API. All available functionality is described here https://veryfi.github.io/veryfi-java/veryfi/Client.html
Below is the sample script using veryfi to OCR and extract data from a document:
import veryfi.*;
import java.util.Arrays;
import java.util.List;
public class Main {
public static void main(String[] args) {
String clientId = "your_client_id";
String clientSecret = "your_client_secret";
String username = "your_username";
String apiKey = "your_password";
Client client = VeryfiClientFactory.createClient(clientId, clientSecret, username, apiKey);
List<String> categories = Arrays.asList("Advertising & Marketing", "Automotive");
String jsonResponse = client.processDocument("example1.jpg", categories, false, null);
}
}Run an extra LLM pass ("thinking") on the line items of receipts and invoices by passing thinking
("light" or "deep") — "deep" is more thorough but slower; leave it out to turn it off. It only
takes effect if thinking mode is enabled for your account. processDocument, processDocumentUrl and
their Async variants support it, either through the extra parameters or via the dedicated overload
that takes a trailing thinking argument.
See https://docs.veryfi.com/api/receipts-invoices/process-a-document/
// Option 1: pass it in the extra parameters
JSONObject parameters = new JSONObject();
parameters.put("thinking", "light");
String jsonResponse = client.processDocument("example1.jpg", categories, false, parameters);
// Option 2: use the dedicated thinking overload
String jsonResponse2 = client.processDocument("example1.jpg", categories, false, null, "deep");Update a document
import veryfi.*;
import org.json.JSONObject;
public class Main {
public static void main(String[] args) {
String clientId = "your_client_id";
String clientSecret = "your_client_secret";
String username = "your_username";
String apiKey = "your_password";
Client client = VeryfiClientFactory.createClient(clientId, clientSecret, username, apiKey);
String documentId = "your_document_id";
JSONObject parameters = new JSONObject();
parameters.put("category", "Meals & Entertainment");
parameters.put("total", 11.23);
String jsonResponse = client.updateDocument(documentId, parameters);
}
}Visit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal
If you run into any issue or need help installing or using the library, please contact support@veryfi.com.
If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!
To learn more about Veryfi visit https://www.veryfi.com/
Below is an introduction to the Java SDK.

