Quick Start Guide
This guide will walk you through the basics of using the Face Recognition API.
Authentication
The API uses JWT for authentication. You'll need to include your JWT in the `Authorization` header of your requests.
Authorization: Bearer YOUR_JWT
Endpoints
The API has the following main endpoints:
/api/v1/faces/register: Register a new face./api/v1/faces/recognize: Recognize a face in an image./api/v1/faces/recognize-video: Recognize faces in a video.
Examples
Here are some examples of how to use the API in different languages.
Python
import requests
image_path = 'path/to/your/image.jpg'
url = 'http://localhost:8000/api/v1/faces/recognize'
headers = {'Authorization': 'Bearer YOUR_JWT'}
with open(image_path, 'rb') as f:
files = {'image': f}
response = requests.post(url, headers=headers, files=files)
print(response.json())
JavaScript (Node.js)
const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');
const imagePath = 'path/to/your/image.jpg';
const url = 'http://localhost:8000/api/v1/faces/recognize';
const token = 'YOUR_JWT';
const form = new FormData();
form.append('image', fs.createReadStream(imagePath));
axios.post(url, form, {
headers: {
...form.getHeaders(),
'Authorization': `Bearer ${token}`
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error);
});
cURL
curl -X POST \
http://localhost:8000/api/v1/faces/recognize \
-H 'Authorization: Bearer YOUR_JWT' \
-F 'image=@/path/to/your/image.jpg'