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β
- Node.js
- Python
- PHP
- Go
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);
}
import http.client
import json
conn = http.client.HTTPSConnection("api.verifik.co")
payload = json.dumps({
"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 token",
'Content-Type': 'application/json'
}
conn.request("POST", "/v2/face-recognition/persons", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.verifik.co/v2/face-recognition/persons', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'JWT token',
'Content-Type' => 'application/json',
],
'json' => [
'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'
]
]);
echo $response->getBody();
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.verifik.co/v2/face-recognition/persons"
payload := map[string]interface{}{
"name": "John Doe",
"images": []string{"base64_encoded_image_1", "base64_encoded_image_2"},
"gender": "M",
"date_of_birth": "1990-01-15",
"nationality": "US",
"collections": []string{"collection_123456789"},
"notes": "VIP customer",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "JWT token")
req.Header.Add("Content-Type", "application/json")
client := &http.Client{}
res, _ := client.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
Response Exampleβ
- 200 OK
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β
- 200
- 400
- 400 (Missing Name)
{
"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"
}
}
{
"error": "Invalid image format",
"message": "INVALID_IMAGE_FORMAT"
}
{
"error": "Person name is required",
"message": "NAME_REQUIRED"
}
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