GET STARTED WITH FACE RECOGNITION

Making your first API call

 

We've written a quick step-by-step guide to walk you through how to create a Kairos Developer account, make your first API call, and interpret the results.

Introduction

Our innovative API simplifies how developers and businesses integrate human identity into their software. Kairos' API is a tool for web developers to build face recognition enabled applications. If you don't have easy access to development resources, we can recommend excellent third-party partners. To learn more about face recognition and how you can use Kairos to transform your business, please contact our sales team.

How it works

Kairos is a simple concept - you submit images and/or videos into our API, and our computer vision algorithms analyze the faces found, then the API returns a bunch of useful data about the faces we find. You can use this to search and compare faces, or measure characteristics such as age, and gender.

Picture of a smiling woman, looking to camera, overlayed with information about her indentity


STEP 1: Register as a Developer

If you are an existing Kairos user, log in to your dashboard. If not, sign-up for Kairos - it's free to test.

SIGN-UP FOR A DEVELOPER ACCOUNT


STEP 2: Get your APP ID and API Key

Once you’ve registered, and confirmed your email, you’ll be able to access your Dashboard. Here you’ll find your ‘App ID’ and ‘(API) Key’. Make a note of these credentials, you will use them in the next step.

Oh, and we automatically created your first app, to save you some time. You can rename this anytime.

Picture of Kairos credentials after user login


STEP 3: Make your first API call

The most simple method to make your first API call is to use cURL.

First, get the URL of a hosted image, for example, https://media.kairos.com/liz.jpg

Picture of a smiling woman


Then, open Terminal (Mac) or Command Prompt (Windows) and type:



In a flash, you’ll receive a JSON response similar to this:



From this response, you can get the age, gender and other attributes of the faces found in your image.


Other code examples:

You can use other code bases to make your API call.

Here’s an example of how to use PHP to retrieve the same JSON response.

Simply insert your Kairos keys and your image URL into the script.

First, create a folder on your local system called “my_api_call”.

Then, create a file inside that folder called “detect.php” that contains this script:



You can run this script on a hosted server, or use a local stack such as MAMP, WAMP, LAMP OR XAMPP.  Simply point your browser to “detect.php”.

For more PHP code, check out our PHP Demo and our miscellaneous PHP examples.

Another option would be to use Python for your API call.

Make sure you have Python installed on your system. (This example uses Python 2.7.)

Firstly, if you haven’t already, create a folder on your local system called “my_api_call”.

Then, create a file inside that folder called “detect.py” that contains this script:



Next, open Terminal (Mac) or Command Prompt (Windows) and cd to your “my_api_call” folder.

Run: python detect.py

You’ll see the JSON response in your Terminal or Command Prompt.

For more Python code, check out our Python Demo and our miscellaneous Python examples.

You can also use Javascript/AJAX to make a call to the Kairos API.

It’s not as secure, because your keys will be exposed, but for internal testing it’s very simple to implement.

Firstly, if you haven’t done so, create a folder on your local system called “my_api_call”.

Then, create a file inside that folder called detect.html that contains this script:



As with the PHP script, you can run it on a hosted server, or use a local stack such as MAMP, WAMP, LAMP OR XAMPP.  Point your browser to your “detect.html” file.

For Ruby developers, we have created a simple detect script.

As with the other examples, create a folder on your local system called “my_api_call” and cd into it.

Then, create a file inside that folder called detect.rb that contains this script:



Run: ruby detect.rb

You’ll see the JSON response in your Terminal or Command Prompt.


Next steps

Now you’ve got comfortable making API calls, check out our plans & rate limits - if you want to try some more features, feel free to explore our full API Reference.

SEE API REFERENCE