# NodeJS API Library

## Faceki API Client V2

The Faceki API Client V2 is a TypeScript library that simplifies interactions with the Faceki API for Know Your Customer (KYC) verifications. It provides a straightforward way to initiate KYC verifications, retrieve verification records, perform face matching, and more.

### Installation

To use the Faceki API Client V2 in your project, install it via npm:

```
npm install @faceki/nodejs-api-client
```

### Usage

1. Import the `FacekiAPIClientV2` class:

   ```
   import FacekiAPIClientV2 from '@faceki/nodejs-api-client';
   ```
2. Initialize an instance of the client with your credentials:

   ```
   const client = new FacekiAPIClientV2('your_client_id', 'your_client_secret');
   ```
3. Utilize the available methods to interact with the Faceki API:
   * **Initiate Multi-Document KYC Verification**:

     ```
     const multiKycResponse = await client.requestMultiDocumentKYC(
       selfieImageBuffer,
       idFrontImageBuffer,
       idBackImageBuffer,
       dlFrontImageBuffer,
       dlBackImageBuffer,
       ppFrontImageBuffer
     );
     ```
   * **Initiate Single-Document KYC Verification**:

     ```
     const singleKycResponse = await client.requestSingleDocumentKYC(
       selfieImageBuffer,
       docFrontImageBuffer,
       docBackImageBuffer
     );
     ```
   * **Generate KYC Verification Link**:

     ```
     const kycLink = await client.generateKYCLink(
      expireTime,
      applicationId,
      redirect_url,
      document_optional,
      require_additional_doc);
     ```
   * **Fetch KYC Verification Summary**:

     ```
     const summary = await client.getKycSummary();
     ```
   * **Fetch KYC Records by Link ID**:

     ```
     const kycRecordsByLink = await client.getKYCrecordsByLink(linkId);
     ```
   * **Fetch KYC Records by Request ID**:

     ```
     const kycRecordsByRequestId = await client.getKYCRecordByRequestId(requestId);
     ```
   * **Fetch KYC Records by Reference ID**:

     ```
     const kycRecordsByReference = await client.getKYCRecordByReference(referenceId);
     ```
   * **Fetch KYC Records by Selfie**:

     ```
     const kycRecordsBySelfie = await client.getKYCrecordsBySelfie(selfieImageBuffer);
     ```

### Error Handling

The client manages various response statuses and errors, throwing custom error messages when necessary. Make sure to handle these errors appropriately in your code.

### Contributing

Contributions are welcome! If you encounter issues, have suggestions, or wish to improve the client, please open issues and pull requests.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kycdocv2.faceki.com/api-libraries/nodejs-api-library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
