Skip to content
Java library for the Onfido API
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.
onfido-java Release v1.0.1 (#23) Mar 18, 2020
.gitignore Make changes to project structure (#12) Feb 11, 2020
.maven.xml Fixing travis deployment script and maven config (#14) Feb 14, 2020
.travis.yml Fix travis file for forks (#21) Mar 13, 2020
LICENSE Et 18 release setup (#9) Feb 11, 2020 Adds example of importing model (Applicant) Feb 19, 2020
pom.xml Feature/initial setup (#1) Jan 21, 2020

Onfido Java Library

The official Java library for integrating with the Onfido API.

Documentation can be found at


For Maven projects, add the below to your pom file:


For Gradle projects add the below to your build.gradle file:

implementation 'com.onfido:onfido-api-java:LATEST_VERSION_HERE'

The latest version can be found at:

Getting Started

Import the Onfido object, this is the main object used for interfacing with the API:

import com.onfido.Onfido;

import com.onfido.exceptions.ApiException;
import com.onfido.exceptions.OnfidoException;

Instantiate and configure an Onfido instance with your API token, and region if necessary:

Onfido onfido = Onfido.builder()
                .regionUS() // Defaults to EU region, add this to switch to US

Making a call to the API

Using your configured and instantiated instance of the Onfido object you can make calls to the API by calling one of the methods on the resources inside of it. For example, to create an applicant:

import com.onfido.models.Applicant;


All request bodies can be created using a builder pattern on the Request subclass of the desired resource. For example in the request above an Applicant.Request object is needed as the body, this would look something like:


The above will return an Applicant.Request object that can be provided to the create() method as the request body, so a full call to to the API will look something like:

try {
    Applicant newApplicant = onfido.applicant.create(
} catch (ApiException e) {
    // An error response was received from the Onfido API, extra info is available.
} catch (OnfidoException e) {
    // No response was received for some reason e.g. a network error.

The above method will return the corresponding resource object, as most methods will. In this particular case an Applicant object will return with all information present for the newly created applicant. To access the information call the getter of the desired property on the object, for example:



  1. Fork it (
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes, see below sections for project setup and testing.
  4. Before you commit your changes, run google-java-format for the whole project. See the README in the linked repository for install and running instructions.
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create a new Pull Request

Project Setup

  1. Install JDK 1.8 or above, details for which can be found below:
  2. Install Apache Maven, details for which can be found below:
  3. Inside of the top level directory of the project run the following command:
    mvn clean install
    This will install all necessary dependencies and build the model classes used by the project.


  1. Run mvn test to run all existing automated tests.
  2. View tests in onfido-java/src/test/java/com/onfido for examples of writing tests of your own.

More Documentation

More documentation and code examples can be found at

You can’t perform that action at this time.