Reviewing & Altering Data Storage in Your Architecture
The Database with Your FaceTec Data is owned and managed by Your Team. You and Your Team have 100% control over Data Storage and Deletion, including what type of Data is stored, how long Data is stored, and when Data should be deleted.
FaceTec does not have a built-in option to configure Data Storage or Deletion for the following three reasons:
- There could be concurrency-related behaviors for Customers/Partners using clusters of FaceTec Servers.
- As a policy, FaceTec does not manage, delete, or modify data on behalf of Customers/Partners. Because FaceTec does not place any restrictions on how data is managed, Customers/Partners have complete control over how their Data is stored and deleted.
- Each Customer/Partner has their own requirements for Data Storage and Deletion, and as such, should design a Data Storage and Deletion Strategy that works best for their own objectives.
FaceTec Database Storage Information
Data Storage should be designed to accommodate the needs of Your App & System Architecture. While keeping data for 30 days is an ideal solution for many FaceTec Customers and Partners, some may need to store data for a longer or shorter period of time. Factors to consider when determining your own Data Storage Strategy are the following:
- Number of Users
- Behavior & Usage Patterns
- Database Memory Constraints
- Your Custom Business Logic
- Security & Privacy
- Data Retention Laws
Data Stored by Default
By default, the FaceTec Servers store 3D FaceMaps, Audit Trail Images, ID Scans, and other metadata to support the Server Dashboard GUI.
3D FaceMaps, ID Scans, Audit Trail Images, and all other images are stored in records of the Session collection in the data property as Base64 String values. To learn more about the records in the Session collection, see the MongoDB Session Records Guide.
For /liveness-3d and /enrollment-3d Sessions, objects are stored in the following data properties:
- 3D FaceMap -
data.faceMap - Audit Trail Image -
data.auditTrailImage - Low Quality Audit Trail Image -
data.lowQualityAuditTrailImage
For /match-3d-3d* Sessions, faceMap is updated on the original /enrollment-3d record, while the Audit Trail Images are stored in the following data properties:
- Audit Trail Image -
data.auditTrailImage - Low Quality Audit Trail Image -
data.lowQualityAuditTrailImage
For /match-3d-2d-idscan* and /idscan-only Sessions, objects are stored in the following data properties:
- ID Scan -
data.idScan - ID Scan Front Image -
data.idScanFrontImage - ID Scan Back Image -
data.idScanBackImage - Photo ID Front Image Crop -
data.photoIDFrontCrop - Photo ID Back Image Crop -
data.photoIDBackCrop - Photo ID Face Image Crop -
data.photoIDFaceCrop - Extracted NFC Image -
data.extractedNFCImage
* Important Note: The Match 3D-3D, Match 3D-2D ID Scan, and Age Estimation APIs require the use of a previously enrolled FaceMap. FaceMaps should be stored if you plan on using any of these functionalities.
Storage of Original FaceScans (Requires Configuration)
By default, the FaceTec SDK does not save FaceScans to Your Database, as they will cause your Database to grow at an expedited rate. FaceScans should only be saved when you need to send them to FaceTec to diagnose a behavior. If you do need to save a FaceScan to send to FaceTec, please see Saving 3D FaceScans.
Audit Trail Image Storage
Audit Trail Images are stored in your database and are useful for performing visual inspections of a User's Sessions. Keeping the User's Enrolled Audit Trail Image is useful for a variety of reasons related to ongoing data review:
- You suspect a fraudster is trying to validate himself with another User's Account.
- A User has an unusual number of failed matches, which you suspect are Fraud Attempts.
- Audit Trail Images make it easier to visually differentiate Users and Sessions in the Dashboard SDK.
Important Note: Audit Trail Images are used in many of the FaceTec APIs. Removal of or altering the default behavior of Audit Trail Images can cause unexpected behaviors in your integration and FaceTec recommends testing any of these types of changes ahead of time.
Database Queries - Find Records with a 3D FaceMap
3D FaceMaps are stored in the data.faceMap property for successful /liveness-3d and /enrollment-3d Sessions.
After a successful 3D:3D Match, the original record data.faceMap is updated with an Adaptive 3D FaceMap.
Important Note: The /match-3d-3d API does not create a new, separate 3D FaceMap. Instead, the Enrolled User's 3D FaceMap is updated to an enhanced 3D FaceMap that maintains the same-or-improved security levels, but reduces the FRR in future attempts.
Important Note: In FaceTec Server Webservice v10.0.43 and later, the sessionType property was added database records for querying Session by type.
MongoDB Query Example:
// Find records with a 3D FaceMap.
db.getCollection("Session").find({"callData.path": {$in: ["/liveness-3d", "/enrollment-3d"]}, "data.faceMap": {$exists: true}})
// FaceTec Server Webservice v10.0.43+
db.getCollection("Session").find({"sessionType": {$in: ["Liveness3D", "Enrollment3D"]}, "data.faceMap": {$exists: true}})PostgreSQL Query Example:
-- Find records with a 3D FaceMap.
SELECT * from "Session" where "data"->>'faceMap' IS NOT NULL;Database Queries - Find Audit Trail Images
2D Audit Trail Images are stored in the data.auditTrailImage property for successful /liveness-3d, /enrollment-3d, and /match-3d-3d Sessions.
MongoDB Query Example:
// Find records with a 2D Audit Trail Image.
db.getCollection("Session").find({"callData.path": {$in: ["/liveness-3d", "/enrollment-3d", "/match-3d-3d"]}, success: true}, {"data.auditTrailImage": 1})
// FaceTec Server Webservice v10.0.43+
db.getCollection("Session").find({"sessionType": {$in: ["Liveness3D", "Enrollment3D", "ReVerification3D3D"]}, success: true}, {"data.auditTrailImage": 1})
PostgreSQL Query Example:
-- Find records with a 2D Audit Trail Image.
SELECT "data"->'auditTrailImage' FROM "Session" WHERE "callData"->>'path' IN ('/liveness-3d', '/enrollment-3d', '/match-3d-3d');
// FaceTec Server Webservice v10.0.43+
SELECT "data"->'auditTrailImage' FROM "Session" WHERE "sessionType" IN ('Liveness3D', 'Enrollment3D', 'ReVerification3D3D');Database Queries - Find ID Scan Images
ID Scan Images are stored in the data property for successful Sessions. The images available the data object are photoIDFrontImage, photoIDFrontCrop, photoIDBackImage, photoIDBackCrop, photoIDFaceCrop, photoIDPrimarySignatureCrop, photoIDSecondarySignatureCrop, and extractedNFCImage.
Important Note: Depending on the ID Type and your ID Scan configuration some images may not be available.
MongoDB Query Example:
// Find records with photoIDFrontImage and photoIDBackImage.
db.getCollection("Session").find({"callData.path": {$in: ["/match-3d-2d-idscan", "/idscan-only"]}}, {"data.photoIDFrontImage": 1, "data.photoIDBackImage": 1})
// FaceTec Server Webservice v10.0.43+
db.getCollection("Session").find({"sessionType": {$in: ["PhotoIDScan", "PhotoIDMatch"]}, {"data.photoIDFrontImage": 1, "data.photoIDBackImage": 1})PostgreSQL Query Example:
-- Find records with photoIDFrontImage and photoIDBackImage.
SELECT "data"->'photoIDFrontImage' as "photoIDFrontImage", "data"->'photoIDBackImage' as "photoIDBackImage" FROM "Session" WHERE "callData"->>'path' IN ('/match-3d-2d-idscan', '/idscan-only');
// FaceTec Server Webservice v10.0.43+
SELECT "data"->'photoIDFrontImage' as "photoIDFrontImage", "data"->'photoIDBackImage' as "photoIDBackImage" FROM "Session" WHERE "sessionType" IN ('PhotoIDMatch', 'PhotoIDScan');Database Queries - Deleting Old Data
FaceTec recommends reviewing the information in this guide to understand all types of data that are stored and used by the FaceTec APIs in your database.
Storage space is becoming more affordable over time, and FaceTec recommends keeping a copy of your database on a separate storage before deleting records to avoid permanent data loss from accidental data deletion or database problems, for security and redundancy.
Once a Database Backup has been created, it is recommended to gradually delete data from the Database in small batches while testing the FaceTec components after each deletion to ensure operations are not impacted in any way.
Many Customers/Partners choose to delete data older than 30 Days to ensure their Database remains within their System's Memory Constraints. The examples below are common MongoDB Queries that are used as part of this Data Storage Strategy.
Deleting 3D Liveness Checks
The following query deletes all 3D Liveness Checks that are older than 30 days.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/liveness-3d",
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})
// FaceTec Server Webservice v10.0.43+
db.Session.deleteMany({"sessionType" : "Liveness3D",
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})
PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/liveness-3d' AND timestamp < NOW() - INTERVAL '30 days';
// FaceTec Server Webservice v10.0.43+
DELETE FROM "Session" WHERE "sessionType" = 'Liveness3D' AND timestamp < NOW() - INTERVAL '30 days';Deleting Unsuccessful 3D Enrollments
The following query deletes all Enrollments that failed and are older than 30 days.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/enrollment-3d", "result.livenessProven" : false,
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})
// FaceTec Server Webservice v10.0.43+
db.Session.deleteMany({"sessionType" : "Enrollment3D", "result.livenessProven" : false,
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/enrollment-3d' AND "result"->>'livenessProven' = 'false' AND timestamp < NOW() - INTERVAL '30 days';
// FaceTec Server Webservice v10.0.43+
DELETE FROM "Session" WHERE "sessionType" = 'Enrollment3D' AND "result"->>'livenessProven' = 'false' AND timestamp < NOW() - INTERVAL '30 days';Deleting Match 3D:3D History
The following query deletes all 3D:3D Face Matches that are older than 30 days.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/match-3d-3d",
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})
// FaceTec Server Webservice v10.0.43+
db.Session.deleteMany({"sessionType" : "ReVerification3D3D",
"callData.date" : {$lt: $dateSubtract: { startDate: "$$NOW", unit: "day", amount: 30}}})PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/match-3d-3d' AND timestamp < NOW() - INTERVAL '30 days';
// FaceTec Server Webservice v10.0.43+
DELETE FROM "Session" WHERE "sessionType" = 'ReVerification3D3D' AND timestamp < NOW() - INTERVAL '30 days';Database Queries - Deleting by externalDatabaseRefID
Deleting 3D Enrollment by externalDatabaseRefID
The following query deletes an Enrollment with the given externalDatabaseRefID.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/enrollment-3d", "externalDatabaseRefID": "<INSERT_EXTERNAL_DATABASE_REF_ID>"})
// FaceTec Server Webservice v10.0.43+
db.Session.deleteMany({"sessionType" : "Enrollment3D", "externalDatabaseRefID": "<INSERT_EXTERNAL_DATABASE_REF_ID>"})
PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/enrollment-3d' AND "externalDatabaseRefID" = '<INSERT_EXTERNAL_DATABASE_REF_ID>';
// FaceTec Server Webservice v10.0.43+
DELETE FROM "Session" WHERE "sessionType" = 'Enrollment3D' AND "externalDatabaseRefID" = '<INSERT_EXTERNAL_DATABASE_REF_ID>';Deleting 3D:3D Match by externalDatabaseRefID
The following query deletes a 3D:3D Match with the given externalDatabaseRefID.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/match-3d-3d", "externalDatabaseRefID": "<INSERT_EXTERNAL_DATABASE_REF_ID>"})
PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/match-3d-3d' AND "externalDatabaseRefID" = '<INSERT_EXTERNAL_DATABASE_REF_ID>';Deleting ID Scan by externalDatabaseRefID
The following query deletes an ID Scan with the given externalDatabaseRefID.
MongoDB Query Example:
db.Session.deleteMany({"callData.path" : "/idscan-only", "externalDatabaseRefID": "<INSERT_EXTERNAL_DATABASE_REF_ID>"})
// FaceTec Server Webservice v10.0.43+
db.Session.deleteMany({"sessionType" : "PhotoIDScan", "externalDatabaseRefID": "<INSERT_EXTERNAL_DATABASE_REF_ID>"})
PostgreSQL Query Example:
DELETE FROM "Session" WHERE "callData"->>'path' = '/idscan-only' AND "externalDatabaseRefID" = '<INSERT_EXTERNAL_DATABASE_REF_ID>';
// FaceTec Server Webservice v10.0.43+
DELETE FROM "Session" WHERE "sessionType" = 'PhotoIDScan' AND "externalDatabaseRefID" = '<INSERT_EXTERNAL_DATABASE_REF_ID>';Database Queries - Counting Sessions or Distinct Devices
Number of Sessions
The following queries find the number of Sessions of the given type.
MongoDB Query Example:
// Count of sessions for each session type.
db.getCollection("Session").find({"callData.path": "/liveness-3d"}).count()
db.getCollection("Session").find({"callData.path": "/enrollment-3d"}).count()
db.getCollection("Session").find({"callData.path": "/match-3d-3d"}).count()
db.getCollection("Session").find({"callData.path": "/match-3d-2d-idscan"}).count()
db.getCollection("Session").find({"callData.path": "/idscan-only"}).count()
// FaceTec Server Webservice v10.0.43+
db.getCollection("Session").find({"callData.path": "Liveness3D"}).count()
db.getCollection("Session").find({"callData.path": "Enrollment3D"}).count()
db.getCollection("Session").find({"callData.path": "ReVerification3D3D"}).count()
db.getCollection("Session").find({"callData.path": "PhotoIDMatch"}).count()
db.getCollection("Session").find({"callData.path": "PhotoIDScan"}).count()
PostgreSQL Query Example:
SELECT COUNT(*) from "Session" where "callData"->>'path' = '/liveness-3d' ;
SELECT COUNT(*) from "Session" where "callData"->>'path' = '/enrollment-3d' ;
SELECT COUNT(*) from "Session" where "callData"->>'path' = '/match-3d-3d' ;
SELECT COUNT(*) from "Session" where "callData"->>'path' = '/idscan-only' ;
SELECT COUNT(*) from "Session" where "callData"->>'path' = '/match-3d-2d-idscan' ;
// FaceTec Server Webservice v10.0.43+
SELECT COUNT(*) from "Session" where "sessionType" = 'Liveness3D' ;
SELECT COUNT(*) from "Session" where "sessionType" = 'Enrollment3D' ;
SELECT COUNT(*) from "Session" where "sessionType" = 'ReVerification3D3D' ;
SELECT COUNT(*) from "Session" where "sessionType" = 'PhotoIDScan' ;
SELECT COUNT(*) from "Session" where "sessionType" = 'PhotoIDMatch' ;To learn more about the records in the Session Collection, see the MongoDB Session Records Guide.
Number of Distinct Devices for a Session Type
The following queries find the number of Distinct Devices used for a given Session Type.
MongoDB Query Example:
// Distinct device ID’s that performed a session of each type.
db.getCollection("Session").distinct("additionalSessionData.installationID",{"callData.path": "/liveness-3d"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"callData.path": "/enrollment-3d"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"callData.path": "/match-3d-3d"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"callData.path": "/match-3d-2d-idscan"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"callData.path": "/idscan-only"}).length
// FaceTec Server Webservice v10.0.43+
db.getCollection("Session").distinct("additionalSessionData.installationID",{"sessionType": "Liveness3D"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"sessionType": "Enrollment3D"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"sessionType": "ReVerification3D3D"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"sessionType": "PhotoIDMatch"}).length
db.getCollection("Session").distinct("additionalSessionData.installationID",{"sessionType": "PhotoIDScan"}).lengthPostgreSQL Query Example:
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "callData"->>'path' = '/liveness-3d';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "callData"->>'path' = '/enrollment-3d';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "callData"->>'path' = '/match-3d-3d';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "callData"->>'path' = '/idscan-only';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "callData"->>'path' = '/match-3d-2d-idscan';
// FaceTec Server Webservice v10.0.43+
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "sessionType" = 'Liveness3D';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "sessionType" = 'Enrollment3D';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "sessionType" = 'ReVerification3D3D';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "sessionType" = 'PhotoIDScan';
SELECT COUNT(DISTINCT "additionalSessionData"->>'installationID') from "Session" where "sessionType" = 'PhotoIDMatch';Database Metrics - 3D Liveness Check Metrics (MongoDB)
Successful Liveness Checks:
- Saved Data: Audit Trail and 3D FaceMap
- Size of Record: 132 KB (approximately)
| Number of Records | 1 | 1,000 | 10,000 | 100,000 | 1 Million |
|---|---|---|---|---|---|
| Total Size (approx.) | 132 KB | 132 MB | 1.32 GB | 13.2 GB | 132 GB |
Database Metrics - 3D Enrollment Metrics (MongoDB)
Successful Enrollment:
- Saved Data: Audit Trail and 3D FaceMap
- Size of Record: 146 KB (approximately)
| Number of Records | 1 | 1,000 | 10,000 | 100,000 | 1 Million |
|---|---|---|---|---|---|
| Total Size (approx.) | 146 KB | 132 MB | 1.32 GB | 13.2 GB | 132 GB |
Database Metrics - 3D:3D Match Metrics (MongoDB)
Successful Match:
- Saved Data: No Audit Trail and No 3D FaceMap Saved
- Size of Record: 81 KB (approximately)
| Number of Records | 1 | 1,000 | 10,000 | 100,000 | 1 Million |
|---|---|---|---|---|---|
| Total Size (approx.) | 81 KB | 81 MB | 810 MB | 8.1 GB | 81 GB |
Database Metrics - ID Scan (MongoDB)
Successful Match:
- Saved Data: ID Scan
- Size of Record: 2.5 MB (approximately)*
| Number of Records | 1 | 1,000 | 10,000 | 100,000 | 1 Million |
|---|---|---|---|---|---|
| Total Size (approx.)* | 2.5 MB | 2.5 GB | 25 GB | 250 GB | 2.5 TB |
* These metrics were measured by scanning California Passports and California Driver Licenses that had both Barcodes and NFC Chips.
Database Benchmarks
Important Note: The below benchmarks are measured from API Calls that performed read and write operations on a production MongoDB Database with low traffic and with optimal internet speeds. Since your internet connection and database largely determine the speed the of these operations, the times to complete these API Calls on your system may differ drastically.
/liveness-3d:
- Time to insert record: 50 - 100ms
/enrollment-3d:
- Time to insert record: 50 - 100ms
/match-3d-3d:
- Time to retrieve enrollment record: 150 - 200ms
- Time to insert record: 50 - 100ms
/match-3d-2d-idscan:
- Time to retrieve enrollment record: 150 - 200ms
- Time to retrieve previous ID Scan record: 150 - 300ms
- Time to insert record: 50 - 150ms
/idscan-only:
- Time to retrieve previous ID Scan record: 150 - 300ms
- Time to insert record: 50 - 150ms