Skip to main content

Create a Person

Endpoint​

https://api.verifik.co/v2/face-recognition/persons

The Create Person API allows you to create a new person within the facial recognition system. You can associate a person with their name, images, gender, date of birth, nationality, collections, and additional notes.

Headers​

Content-Type​

Type: String
Required: Required
Value: application/json

Authorization​

Type: String
Required: Required
Value: Bearer <token>

Parameters​

name​

Type: String
Required: Yes

Full name of the person.

images​

Type: Array of String
Required: Yes

Base64-encoded images for recognition.

gender​

Type: String
Required: No

Gender of the person (M or F).

date_of_birth​

Type: String (ISO8601)
Required: No

Date of birth of the person.

nationality​

Type: String
Required: No

Nationality of the person.

collections​

Type: Array of String
Required: No

Array of collection IDs related to this person.

notes​

Type: String
Required: No

Additional notes about the person.

Request​

import axios from 'axios';

const options = {
method: 'POST',
url: 'https://api.verifik.co/v2/face-recognition/persons',
data: {
name: "John Doe",
images: [
"base64_encoded_image_1",
"base64_encoded_image_2"
],
gender: "M",
date_of_birth: "1990-01-15",
nationality: "US",
collections: ["collection_123456789"],
notes: "VIP customer"
},
headers: {
Accept: 'application/json',
Authorization: 'jwt <tu_token>'
}
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}

Response Example​

import Foundation

let headers = [
"Accept": "application/json",
"Authorization": "JWT token",
"Content-Type": "application/json"
]

let parameters = [
"name": "John Doe",
"images": [
"base64_encoded_image_1",
"base64_encoded_image_2"
],
"gender": "M",
"date_of_birth": "1990-01-15",
"nationality": "US",
"collections": ["collection_123456789"],
"notes": "VIP customer"
] as [String : Any]

let postData = try? JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.verifik.co/v2/face-recognition/persons")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})

dataTask.resume()

Response​

{
"success": true,
"data": {
"_id": "person_123456789",
"name": "John Doe",
"gender": "M",
"date_of_birth": {
"year": 1990,
"month": 1,
"day": 15
},
"nationality": "US",
"images": [
"base64_encoded_image_1",
"base64_encoded_image_2"
],
"collections": ["collection_123456789"],
"notes": "VIP customer",
"client": "client_123456789",
"status": "active",
"faceEncodings": [
"face_encoding_1",
"face_encoding_2"
],
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}

Features​

  • Person Creation: Create new individuals in the facial recognition system
  • Image Upload: Support for multiple Base64-encoded images
  • Collection Assignment: Assign persons to specific collections
  • Automatic Processing: Face encodings generated automatically
  • Structured Response: Organized data format for easy integration
  • Multiple Programming Languages: Support for JavaScript, Python, PHP, and Swift
  • Error Handling: Comprehensive error responses for various scenarios