Skip to main content

Encrypt Face Proof

Endpoint​

POST https://api.verifik.co/v2/zelf-proof/encrypt

Creates a zero-knowledge face proof by encrypting facial data and storing it on IPFS. The proof can later be verified without exposing the original biometric data.

Headers​

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Params​

NameTypeRequiredDescription
faceBase64stringYesBase64 encoded facial image
requireLivenessbooleanYesWhether to require liveness detection
livenessLevelstringYesLiveness detection level (REGULAR, SOFT, HARDENED)
osstringYesOperating system (DESKTOP, ANDROID, IOS)
identifierstringYesUnique identifier (alphanumeric only, no spaces or special characters)
publicDataobjectYesPublic data to be stored with the proof (string key-value pairs)
metadataobjectYesPrivate metadata (string key-value pairs)
passwordstringNoOptional password for additional security
referenceFaceBase64stringNoReference face for comparison
tolerancestringNoTolerance level (REGULAR, SOFT, HARDENED)
verifierKeystringNoVerifier key for additional validation
livenessDetectionPriorCreationbooleanNoEnable liveness detection before proof creation

Request​

const fetch = require("node-fetch");

async function run() {
const res = await fetch("https://api.verifik.co/v2/zelf-proof/encrypt", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.VERIFIK_TOKEN}`,
},
body: JSON.stringify({
faceBase64: "<base64_image>",
requireLiveness: false,
livenessLevel: "REGULAR",
password: "1234",
os: "DESKTOP",
identifier: "randomid",
publicData: {
"a": "1",
"b": "2",
"vida": "true"
},
metadata: {
"secretA": "3",
"secretB": "sijfoidjfijdifj"
}
}),
});
console.log(await res.json());
}

run();

Response​

{
"data": {
"zelfProof": "A39T6XGv2ld+/lwCeB11tcXKFUE2+4LkYwr2BfVwko8OvAqFCavD2S5o62IsxIH8QuQ6K9z1yJ6qhedWojVAhlMoufcpZLlhSknJTUMsql+FXXECoZ0elw3ZCKm1DHrrn3QoRtv3Pfc1EPB2fSoXan2RjFEnkolmrNA/FvRaEOgPeFLUlOFAVzYRVVsoFfe9N6pNZ9q5uCRti7vUwPz5LnObB5uVxFyNZFxZJKrJmqkEHWI+elEqQR/7KnGtwgyN4TNnVGdbyRUUZ8eTztGal5VHIDwYdKxIbjDb1x+xz/elCShcHr4K2QhG+cefp1hj6GFg8BSLF83Wk5U20Cm5V6G0F3Vjk4yNDc7IQB6OfvEDsD8OEov4xBG51D7pw6ukFrw/FrlHBbR+KV6We8t7pJ5/vzFll1tZKcki4PoOXcu/DzmhEVVb0DoVRcB53sbxpU0G5aT0hRH2rhs1jI0yitSzISqFOTNCb7wm3CQoA2ZGndx4+DLaoKjOb/9RFlRyk2FWpM1QGAPGMbJbDeW1JrZmBTsWQ6vTr6U+JdCZA2ZxEXIsugpzbkbMMnisW8m+ddoYJm2TJTvYI8XX6bLtC6T6dEM0oFPbJkjcYdW6bemsaMm0+evZUdREs7E435jDXEoJEP0LOufTluGYcstrTqcwKtSwM5OKK9qH27WNaWcybYrKw8tA0RBUf1jDc8ChHiKXRtiUQ3JxKzK2qLnlpBYLo/0Kyy0tYP7xK1lhxaJvMks8igH/jOuyjqLL0MmOs9EnCGZayJD/UQcu84XgDQKmVxk2zFUVhol7HlcRgpMisVaSawWhpnZtPFAeV+rpJgYAR8g4NjhZ7d9QGuHTdrxmGhHZcEyTqblMx4Kx4UVdWKzvHgaFjFFYag2w",
"ipfs": {
"url": "https://blush-selective-earwig-920.mypinata.cloud/ipfs/bafkreibu6ouy66tv7mmqbf4rxjd2tywdhfad2vri2sk562bltuz663imwu",
"IpfsHash": "bafkreibu6ouy66tv7mmqbf4rxjd2tywdhfad2vri2sk562bltuz663imwu",
"PinSize": 965,
"Timestamp": "2025-10-15T15:22:00.333Z",
"ID": "8e4dd38b-580d-4bf7-a71d-5c6d4e7dc008",
"Name": "613375a1eab2fe08527f81e2_zk_randomid_93558.json",
"NumberOfFiles": 1,
"MimeType": "application/json",
"GroupId": "861b93d7-9795-461d-b479-31f751d6869e",
"pinned": true,
"web3": true,
"name": "613375a1eab2fe08527f81e2_zk_randomid_93558.json",
"metadata": [
"a",
"b",
"vida"
]
}
},
"credits": {
"amount": -0.84,
"status": "approved",
"category": "usage",
"client": "613375a1eab2fe08527f81e2",
"superAdmin": null,
"expensesGroup": "613375a1eab2fe08527f81e2_zk_randomid_93558",
"group": "Zelf",
"product": "other",
"code": "zelf-proofs",
"transaction": null,
"expiresAt": null,
"isExpired": false,
"referenceCredit": null,
"_id": "68efbc187fb658e0366a3019",
"updatedAt": "2025-10-15T15:22:00.907Z",
"createdAt": "2025-10-15T15:22:00.907Z",
"__v": 0
}
}

Notes​

  • The zelfProof token contains the encrypted facial proof and should be stored securely
  • IPFS data includes metadata about the stored proof and public data keys
  • Credits are deducted for proof creation (typically 0.84 credits)
  • The identifier must be alphanumeric only (no spaces or special characters)
  • publicData and metadata must contain only string key-value pairs
  • Liveness detection can be enabled for additional security
  • Password protection adds an extra layer of security to the proof