Get User Verification

Overview

After creating a verification session and initiating the verification process, you may need to retrieve detailed information about a user's session. VOVE ID provides an endpoint for this purpose. This section outlines how to retrieve user's session information. This operation is typically triggered after the backend receives a webhook notification via our system.


Endpoint and Request

Endpoint: GET /v2/users/:refId

Headers:

  • Content-Type: application/json

  • x-api-key: API_KEY

Path Parameters:

  • refId The user identifier in your system.

Example Request:

GET /v2/users/3eb8c91c-c866-4fcb-9805-67e8b45c7883 HTTP/1.1
Content-Type: application/json
x-api-key: YOUR_API_KEY

Get User Session

On a successful request, the API will return detailed information about the user's session. An example response might look like this:

{
  "_id": "66f1f1dd3a091e401033b270",
  "refId": "F1A1B12C-4F32-43A2-BE72-9DAB8D4C6E2B",
  "status": "successful",
  "createdAt": "2024-09-23T22:55:25.894Z",
  "updatedAt": "2024-09-23T22:55:25.895Z",
  "flowId": "76g12d91a2836ecf43cdcb40",
  "sessionId": "76g12d91a2836ecf43cdcb46",
  "sessions": [
    "76g12d91a2836ecf43cdcb46"
  ],
  "documents": [
    {
      "stepId": StepId.ID_DOCUMENT,
      "firstName": "JOHN",
      "lastName": "DOE",
      "dateOfExpiration": "15/07/2030",
      "address1": "1234 FAKE STREET, SPRINGFIELD",
      "dateOfIssue": "15/07/2020",
      "sex": "M",
      "dateOfBirth": "01/01/1990",
      "issuingAuthority": "SPRINGFIELD MUNICIPALITY",
      "placeOfBirth": "SPRINGFIELD",
      "mrzLine1": "P<USAJOHN<<DOE<<<<<<<<<<<<<<<<<<<<<<<<<<",
      "mrzLine2": "X12345678USA900101M3007155DOE<<<<<<<<<<",
      "idNumber": "X12345678",
      "matchLevel": 7
    },
    {
      "stepId": StepId.DRIVER_LICENSE,
      "type": "Driver License",
      "firstName": "JOHN",
      "lastName": "DOE",
      "dateOfIssue": "10/05/2015",
      "dateOfBirth": "01/01/1990",
      "idNumber": "DL987654321"
    },
    {
      "stepId": StepId.ADDRESS_PROOF,
      "docTypes": ["UTILITY_BILL_ELECTRICITY"],
      "fullName": "JOHN DOE",
      "issueDate": "10/05/2015",
      "issuerName": "Electric",
      "address": "Avenue John doe, DE, USA"
    }
  ],
  "metadata": [
    "203.0.113.5"
  ]
}
enum StepId {
  ID_DOCUMENT = 'ID_DOCUMENT',
  DRIVING_LICENSE = 'DRIVING_LICENSE',
  CAR_REGISTRATION_DOCUMENT = 'CAR_REGISTRATION_DOCUMENT',
  ADDRESS_PROOF = 'ADDRESS_PROOF'
}

Get session documents:

GET /v2/users/3eb8c91c-c866-4fcb-9805-67e8b45c7883/documents HTTP/1.1
Content-Type: application/json
x-api-key: YOUR_API_KEY

Example Response

On a successful request, the API will return detailed information about the user's session. An example response might look like this:

{
  "selfie": "base_64",
  "documents": [
    {
      "stepId": StepId.ID_DOCUMENT,
      "front": "base_64",
      "photo": "base_64",
      "frontCropped": "base_64",
      "backCropped": "",
      "type": "Passport",
      "firstName": "JOHN",
      "lastName": "DOE",
      "dateOfExpiration": "15/07/2030",
      "address1": "1234 FAKE STREET, SPRINGFIELD",
      "dateOfIssue": "15/07/2020",
      "sex": "M",
      "dateOfBirth": "01/01/1990",
      "issuingAuthority": "SPRINGFIELD MUNICIPALITY",
      "placeOfBirth": "SPRINGFIELD",
      "mrzLine1": "P<USAJOHN<<DOE<<<<<<<<<<<<<<<<<<<<<<<<<<",
      "mrzLine2": "X12345678USA900101M3007155DOE<<<<<<<<<<",
      "idNumber": "X12345678",
      "matchLevel": 7
    },
    {
      "stepId": StepId.DRIVING_LICENSE,
      "front": "base_64",
      "back": "base_64",
      "photo": "base_64",
      "frontCropped": "base_64",
      "backCropped": "base_64",
      "type": "Driver License",
      "firstName": "JOHN",
      "lastName": "DOE",
      "dateOfIssue": "10/05/2015",
      "dateOfBirth": "01/01/1990",
      "idNumber": "DL987654321"
    },
     {
      "stepId": StepId.ADDRESS_PROOF,
      "docTypes": ["UTILITY_BILL_ELECTRICITY"],
      "fullName": "JOHN DOE",
      "issueDate": "10/05/2015",
      "issuerName": "Electric",
      "address": "Avenue John doe, DE, USA",
      "documentPath": "base64",
    }
  ],
}

Handling Webhook Notifications

When the verification process is completed or any specific event occurs, VOVE ID will send a webhook notification to your backend.. Upon receiving a webhook, your backend can trigger the retrieval of session information.

Step-by-Step Process:

  1. Set Up Webhook Listener:

    • Configure your backend to listen for webhook notifications from us.

    • Ensure that your webhook endpoint can handle POST requests.

  2. Receive Webhook Notification:

    • When a webhook is received, parse the payload to extract relevant information, using the refId.

  3. Trigger Session Information Retrieval:

    • Use the refId to make a GET request to the GET /users/:refId endpoint.

    • Include the API_KEY in the request header for authentication.

Example Code for Webhook Handling and Session Retrieval:

const express = require('express');
const axios = require('axios');

const app = express();
app.use(express.json());

app.post('/webhook', async (req, res) => {
  // refId is the ID you provided earlier to create the session
  const { refId } = req.body; // Extract refId from webhook payload

  try {
    // Retrieve session information
    const sessionInfo = await axios.get(`https://api.voveid.net/v2/users/${refId}`, {
      headers: {
        'Content-Type': 'application/json',
        'x-api-key': 'YOUR_API_KEY'
      }
    });

    console.log('Session Information:', sessionInfo.data);

    // Process the session information as needed
    // ...

    res.status(200).send('Webhook received and session information retrieved successfully.');
  } catch (error) {
    console.error('Error retrieving session information:', error);
    res.status(500).send('Failed to retrieve session information.');
  }
});

// Start the Express server
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`Server is running on port ${PORT}`);
});

Note: If you’re still using userId from earlier implementations, it will still be included in the webhook payload for backward compatibility, but we recommend switching to refId, which is now the standard identifier.


Conclusion

By following the steps outlined in this section, clients can efficiently retrieve and handle user's session information in VOVE ID. This process ensures that all relevant data about the user's verification session is accessible and can be used to make informed decisions or further actions within the client's application.

Last updated