Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.
/ api-java-client Public archive

This is an auto-generated client library for the Onfido API

License

Notifications You must be signed in to change notification settings

onfido/api-java-client

Repository files navigation

⚠️ Please use onfido-java instead ⚠️

This library has been superseded by onfido-java

onfido-java

Onfido API

  • API version: 3.0.0
    • Build date: 2020-01-13T16:30:58.546Z[GMT]

The Onfido API is used to submit check requests.

Automatically generated by the OpenAPI Generator

NOTE: This package is not available on Maven Central.

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

This package is not currently available on Maven Central.

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/onfido-java-5.0.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/v3");

        DefaultApi apiInstance = new DefaultApi();

        // Setting applicant details

        Applicant applicantDetails = new Applicant();
        applicantDetails.setFirstName("Jane");
        applicantDetails.setLastName("Doe");
        applicantDetails.setDob(LocalDate.parse("1990-01-31"));

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

        applicantDetails.setAddress(address);

        // Setting check details

        Check checkData = new Check();

        List<String> reportNames = new ArrayList<String>();
        reportNames.add("identity_standard");
        checkData.setReportNames(reportNames);

        // Create an applicant and then a check with an Identity report

        try {
            Applicant newApplicant = apiInstance.createApplicant(applicantDetails);
            String applicantId = newApplicant.getId();
            System.out.println("Applicant ID: " + applicantId);
            checkData.setApplicantId(applicantId);
            Check newCheck = apiInstance.createCheck(checkData);
            System.out.println(newCheck);
        } catch (ApiException e) {
            System.err.println(e.getResponseBody());
        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
DefaultApi cancelReport POST /reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
DefaultApi createApplicant POST /applicants Create Applicant
DefaultApi createCheck POST /checks Create a check
DefaultApi createWebhook POST /webhooks Create a webhook
DefaultApi deleteWebhook DELETE /webhooks/{webhook_id} Delete a webhook
DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
DefaultApi downloadDocument GET /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 editWebhook PUT /webhooks/{webhook_id} Edit a webhook
DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
DefaultApi findCheck GET /checks/{check_id} Retrieve a Check
DefaultApi findDocument GET /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 /reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
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 /checks Retrieve Checks
DefaultApi listDocuments GET /documents List documents
DefaultApi listLivePhotos GET /live_photos List live photos
DefaultApi listLiveVideos GET /live_videos List live videos
DefaultApi listReports GET /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 /reports/{report_id}/resume This endpoint is for resuming individual paused reports.
DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
DefaultApi uploadDocument POST /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.