Skip to content
This is an auto-generated client library for Onfido API v2
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
gradle/wrapper
src
LICENSE
README.md
build.gradle
build.sbt
gradle.properties
gradlew
gradlew.bat
pom.xml
settings.gradle

README.md

onfido-java

Onfido API

  • API version: 2.0.0
    • Build date: 2019-03-07T15:33:35.406Z[GMT]

The Onfido API is used to submit check requests.

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.onfido</groupId>
  <artifactId>onfido-java</artifactId>
  <version>3.1.0</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.onfido:onfido-java:3.1.0"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/onfido-java-3.1.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import com.onfido.*;
import com.onfido.auth.*;
import com.onfido.models.*;
import com.onfido.api.DefaultApi;

import java.time.LocalDate;
import java.io.File;
import java.util.*;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure API key authorization: Token
        ApiKeyAuth tokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("Token");
        tokenAuth.setApiKey("token=" + "YOUR API TOKEN");
        tokenAuth.setApiKeyPrefix("Token");

        // Limit the at-rest region, if needed (optional, see https://documentation.onfido.com/#regions)
        // defaultClient.setBasePath("https://api.us.onfido.com/v2");

        DefaultApi api = new DefaultApi();

        // Setting applicant details
        Applicant applicant = new Applicant();
        applicant.setFirstName("John");
        applicant.setLastName("Smith");
        applicant.setDob(LocalDate.parse("1980-01-22"));
        applicant.setCountry("GBR");

        Address address = new Address();
        address.setBuildingNumber("100");
        address.setStreet("Main Street");
        address.setTown("London");
        address.setPostcode("SW4 6EH");
        address.setCountry("GBR");

        List<Address> addresses = new ArrayList<Address>();
        addresses.add(address);
        applicant.setAddresses(addresses);

        // Setting check details
        Check check = new Check();
        check.setType("express");

        Report report = new Report();
        report.setName("identity");

        List<Report> reports = new ArrayList<Report>();
        reports.add(report);
        check.setReports(reports);

        try {
            Applicant newApplicant = api.createApplicant(applicant);
            String applicantId = newApplicant.getId();
            System.out.println("Applicant ID: " + applicantId);
            Check newCheck = api.createCheck(applicantId, check);
            System.out.println(newCheck);
        } catch (ApiException e) {
            System.err.println("Exception creating an applicant/check");
            System.err.println(e.getResponseBody());
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.onfido.com/v2

Class Method HTTP request Description
DefaultApi cancelReport POST /checks/{check_id}/reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
DefaultApi createApplicant POST /applicants Create Applicant
DefaultApi createCheck POST /applicants/{applicant_id}/checks Create a check
DefaultApi createWebhook POST /webhooks Create a webhook
DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
DefaultApi downloadDocument GET /applicants/{applicant_id}/documents/{document_id}/download Download a documents raw data
DefaultApi downloadLivePhoto GET /live_photos/{live_photo_id}/download Download live photo
DefaultApi downloadLiveVideo GET /live_videos/{live_video_id}/download Download live video
DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
DefaultApi findCheck GET /applicants/{applicant_id}/checks/{check_id} Retrieve a Check
DefaultApi findDocument GET /applicants/{applicant_id}/documents/{document_id} A single document can be retrieved by calling this endpoint with the document’s unique identifier.
DefaultApi findLivePhoto GET /live_photos/{live_photo_id} Retrieve live photo
DefaultApi findLiveVideo GET /live_videos/{live_video_id} Retrieve live video
DefaultApi findReport GET /checks/{check_id}/reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
DefaultApi findReportTypeGroup GET /report_type_groups/{report_type_group_id} Retrieve single report type group object
DefaultApi findWebhook GET /webhooks/{webhook_id} Retrieve a Webhook
DefaultApi generateSdkToken POST /sdk_token Generate a SDK token
DefaultApi listApplicants GET /applicants List Applicants
DefaultApi listChecks GET /applicants/{applicant_id}/checks Retrieve Checks
DefaultApi listDocuments GET /applicants/{applicant_id}/documents List documents
DefaultApi listLivePhotos GET /live_photos List live photos
DefaultApi listLiveVideos GET /live_videos List live videos
DefaultApi listReportTypeGroups GET /report_type_groups Retrieve all report type groups
DefaultApi listReports GET /checks/{check_id}/reports All the reports belonging to a particular check can be listed from this endpoint.
DefaultApi listWebhooks GET /webhooks List webhooks
DefaultApi restoreApplicant POST /applicants/{applicant_id}/restore Restore Applicant
DefaultApi resumeCheck POST /checks/{check_id}/resume Resume a Check
DefaultApi resumeReport POST /checks/{check_id}/reports/{report_id}/resume This endpoint is for resuming individual paused reports.
DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
DefaultApi uploadDocument POST /applicants/{applicant_id}/documents Upload a document
DefaultApi uploadLivePhoto POST /live_photos Upload live photo

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.