Onfido - JavaScript client for onfido The Onfido API is used to submit check requests. This SDK is automatically generated by the Swagger Codegen project:
- API version: 2.0.0
- Package version: 1.5.0
- Build date: 2018-12-14T11:19:41.641Z
- Build package: class io.swagger.codegen.languages.JavascriptClientCodegen
For Node.js
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install onfido --save
If the library is hosted at a git repository, e.g. https://github.com/onfido/api-javascript-client then install it via:
npm install onfido/api-javascript-client --save
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Please follow the installation instruction and execute the following JS code:
var Onfido = require('onfido');
var defaultClient = Onfido.ApiClient.instance;
// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'token=' + 'YOUR API KEY';
Token.apiKeyPrefix = 'Token';
var api = new Onfido.DefaultApi();
// setting applicant details
var applicant = new Onfido.Applicant();
applicant.first_name = 'John';
applicant.last_name = 'Smith';
applicant.dob = new Date('1980-01-22');
applicant.country = 'GBR';
var address = new Onfido.Address();
address.building_number = '100';
address.street = 'Main Street';
address.town = 'London';
address.postcode = 'SW4 6EH';
address.country = 'GBR';
applicant.addresses = [address];
// setting check request details
var check = new Onfido.CheckCreationRequest();
check.type = 'express';
var report = new Onfido.Report();
report.name = 'identity';
check.reports = [report];
var createApplicantCallback = function(error, data, response) {
if (error) {
console.error(error.response.body);
} else {
var applicantId = data.id;
api.createCheck(applicantId, {'data': check}, createCheckCallback);
}
};
var createCheckCallback = function(error, data, response) {
if (error) {
console.error(error.response.body);
} else {
console.log(data);
}
};
api.createApplicant({'data': applicant}, createApplicantCallback);
To use the US region you need the following configuration:
api.apiClient.basePath = 'https://api.us.onfido.com/v2';
All URIs are relative to https://api.onfido.com/v2
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 | 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 | 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 | 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 | 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 |
- Onfido.Address
- Onfido.Applicant
- Onfido.ApplicantsList
- Onfido.Check
- Onfido.CheckCreationRequest
- Onfido.ChecksList
- Onfido.Document
- Onfido.DocumentsList
- Onfido.Error
- Onfido.GenericAddress
- Onfido.GenericAddressesList
- Onfido.IdNumber
- Onfido.LivePhoto
- Onfido.LivePhotosList
- Onfido.Report
- Onfido.ReportType
- Onfido.ReportTypeGroup
- Onfido.ReportTypeGroupsList
- Onfido.ReportTypeOption
- Onfido.ReportsList
- Onfido.Webhook
- Onfido.WebhooksList