Skip to content
This is an auto-generated client library for Onfido API v2
Branch: master
Clone or download
Engineering at Onfido
Engineering at Onfido New client release: 3.1.0
Latest commit 2e3d9b8 Mar 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.


Onfido - JavaScript client for onfido The Onfido API is used to submit check requests.

This package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.0
  • Package version: 3.1.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen


For Node.js

Install via npm:

npm install onfido

Alternatively, if you're using Yarn:

yarn add onfido

Getting Started

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

const Onfido = require('onfido');

const defaultClient = Onfido.ApiClient.instance;

// Configure API key authorization: Token
const token_auth = defaultClient.authentications['Token'];
token_auth.apiKey = 'token=' + 'YOUR API KEY';
token_auth.apiKeyPrefix = 'Token';

// Limit the at-rest region, if needed (optional, see
// defaultClient.basePath = Onfido.ApiClient.getBasePathFromSettings(1, {region: 'us'});

const api = new Onfido.DefaultApi();

// Setting applicant details
const applicant = new Onfido.Applicant();
applicant.first_name = 'John';
applicant.last_name = 'Smith';
applicant.dob = new Date('1980-01-22'); = 'GBR';

// You can also use getters and setters for properties using camelCase:
// applicant.setFirstName('John');
// applicant.setLastName('Smith');

const address = new Onfido.Address();
address.building_number = '100';
address.street = 'Main Street'; = 'London';
address.postcode = 'SW4 6EH'; = 'GBR';

applicant.addresses = [address];

// Setting check details
const check = new Onfido.Check();
check.type = 'express';
const report = new Onfido.Report(); = 'identity';
check.reports = [report];

// Using promises
api.createApplicant(applicant).then(applicantData => {
  const applicantId =;
  return api.createCheck(applicantId, check);
}).then(checkData => {
}).catch(error => {

// Using async/await
(async () => {
  try {
    const applicantData = await api.createApplicant(applicant);
    const applicantId =;
    const checkData = await api.createCheck(applicantId, check);
  } catch(error) {

Uploading and Downloading

For uploading files, the file argument should be a Readable Stream. For example, for uploading a document:

const documentImage = fs.createReadStream('document.png');
api.uploadDocument(applicantId, 'passport', documentImage);

There is currently an issue with OpenAPI Generator, the tool used to generate this library, that prevents downloading files from working in Node. As a workaround, you can use the API endpoints for downloading files directly. See the API documentation for more info:

Documentation for API Endpoints

All URIs are relative to

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

Documentation for Models

Documentation for Authorization


  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header
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.