Getting Started with Kairos API

Thanks for choosing the Kairos API to integrate face recognition into your project. Getting started with a new API can sometimes be a challenge, so 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

We've made it easy to bring facial identity, emotion, and demographic data into your apps and services.

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 emotion, 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 - our free plan is designed for testing.

CREATE A FREE 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