Facial Recognition Reverse Image Face Search API

Let your users search the Internet by face! Integrate FaceCheck facial search seamlessly with your app, website or software platform.
FaceCheck's REST API is hassle-free and easy to use. 1 search costs 3 credits. Purchase credits with Bitcoin for $0.10 USD per credit.

Hassle Free API

  1. or... Login to Account
  2. Add search credits with Bitcoin
  3. Programmatically search the Internet by face

Code Examples for Search by Face

Code illustrates how to run a face search

  1. Upload an image as multipart/form-data to /api/upload_pic and get id_search
  2. Run a search and get its progress by posting id_search to /api/search
  3. Iterate over the returned json search results

Testing Mode

Example code has TESTING_MODE=True for testing purposes. In testing mode only 100,000 faces are scanned. Testing mode search is fast and doesn't consume much compute power and the search results are not useful but credits will not be deducted. When you're ready for real search, set TESTING_MODE=False.

For all the descriptions of the API endpoints and data structures see FaceCheck Swagger Specification

import time
import requests
import urllib.request

# Download the photo of the person you want to find
urllib.request.urlretrieve('https://www.indiewire.com/wp-content/uploads/2018/01/daniel-craig.jpg?w=300', "daniel.jpg")
image_file = 'daniel.jpg' 

def search_by_face(image_file):
        print('****** TESTING MODE search, results are bad, but credits are NOT deducted ******')

    headers = {'accept': 'application/json', 'Authorization': APITOKEN}
    files = {'images': open(image_file, 'rb'), 'id_search': None}
    response = requests.post(site+'/api/upload_pic', headers=headers, files=files).json()

    if response['error']:
        return f"{response['error']} ({response['code']})", None

    id_search = response['id_search']
    print(response['message'] + ' id_search='+id_search)
    json_data = {'id_search': id_search, 'with_progress': True, 'status_only': False, 'demo': TESTING_MODE}

    while True:
        response = requests.post(site+'/api/search', headers=headers, json=json_data).json()
        if response['error']:
            return f"{response['error']} ({response['code']})", None
        if response['output']:
            return None, response['output']['items']
        print(f'{response["message"]} progress: {response["progress"]}%')

# Search the Internet by face
error, urls_images = search_by_face(image_file)

if urls_images:
    for im in urls_images:      # Iterate search results
        score = im['score']     # 0 to 100 score how well the face is matching found image
        url = im['url']         # url to webpage where the person was found
        image_base64 = im['base64']     # thumbnail image encoded as base64 string
        print(f"{score} {url} {image_base64[:32]}...")
using System.Net;

namespace FaceCheckAPI
    public class SearchItem
        public string? guid { get; set; }
        public int score { get; set; }
        public string? base64 { get; set; }
        public string? url { get;  set; }
        public int index { get; set; } = -1;

    public class Search_Results
        public List? items { get; set; }

    public class InputImage
        public string? base64 { get; set; }
        public string? id_pic { get; set; }

    public class BrowserJsonResponse
        public string? id_search { get; set; }
        public string? message { get; set; }
        public int? progress { get; set; }
        public string? error { get; set; }
        public string? code { get; set; }
        public Search_Results? output { get; set; }
        public List? input { get; set; }

    public class FaceCheckAPI
        static bool TESTING_MODE = true;
        static string APITOKEN = "YOUR_API_TOKEN"; // Your API Token
        static string site = "https://facecheck.id";

        static readonly HttpClient client = new HttpClient();
        static FaceCheckAPI()
            client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", APITOKEN);
        public static async Task?> Search_by_FaceAsync(string image_file)
            if (TESTING_MODE) Console.WriteLine("****** TESTING MODE search, results are bad, but credits are NOT deducted ******");

            using (var content = new MultipartFormDataContent("Upload----" + DateTime.Now.Ticks.ToString("x")))
                using (var ImageStream = new FileStream(image_file, FileMode.Open, FileAccess.Read, FileShare.None))
                    content.Add(new StreamContent(ImageStream), "images", Path.GetFileName(image_file));
                    using (var message = await client.PostAsync(site + "/api/upload_pic", content))
                        var input = await message.Content.ReadAsStringAsync();
                        BrowserJsonResponse? a = System.Text.Json.JsonSerializer.Deserialize(input);
                        if (a.error != null) throw new Exception(a.error);
                        Console.WriteLine(a.message + " id_search=" + a.id_search);

                        while (true)
                            BrowserJsonResponse? b = await PostSearch(Convert.ToString(a.id_search));
                            if (b.error != null) throw new Exception(b.error);
                            if (b.output != null) return b.output.items;
                            Console.WriteLine($"{b.message} Progress: {b.progress}%");
                            await Task.Delay(1000);

        private static async Task PostSearch(string? id_search)
            using (var _Body = new StringContent($"{{\"id_search\":\"{id_search}\",\"with_progress\":true,\"status_only\":false,\"demo\":TESTING_MODE}}"))
                _Body.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                using (var msg = await client.PostAsync(site + "/api/search", _Body))
                    string json = await msg.Content.ReadAsStringAsync();
                    return System.Text.Json.JsonSerializer.Deserialize(json);

    internal class Program
        static async Task Main(string[] args)
                //download a test image 
                using (WebClient webClient = new WebClient())
                    webClient.DownloadFile("https://www.indiewire.com/wp-content/uploads/2018/01/daniel-craig.jpg?w=300", "daniel.jpg");

                //Search the Internet by face
                var images = await FaceCheckAPI.Search_by_FaceAsync("daniel.jpg");
                if (images != null)
                    foreach (SearchItem im in images) //Iterate search results
                        var score = im.score;     // 0 to 100 score how well the face is matching found image
                        var url = im.url;         // url to webpage where the person was found
                        var image_base64 = im.base64;     // thumbnail image encoded as base64 string
                        //convert to binary .WEBP image
                        byte[] webp_image = Convert.FromBase64String(image_base64.Substring(image_base64.IndexOf(' ') + 1));
                        Console.WriteLine($"{score} {url} {image_base64?.Substring(0, 32)}...");
            catch (Exception ex)
                Console.WriteLine("ERROR: " + ex.Message);