Getting started

The Aikey API is organized around REST. Our API has predictable resource-oriented URLs, accepts raw JSON bodies, returns JSON-encoded responses, and uses standard HTTP response codes.

To get started using the Aikey API we recommend using our REST API. You can initilaize it by using the code below. Just add your own token and secret that you can find in the Aikey Portal.

curl https://api.aikey.io/v1/session/start \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--header "content-type: application/json" \
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.aikey.io/v1/session/start",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => array(
    "X-CLIENTID: ClientId",
    "X-SECRET: ClientSecret"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var client = new RestClient("https://api.aikey.io/v1/session/start");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("X-CLIENTID", "ClientId");
request.AddHeader("X-SECRET", "ClientSecret");
request.AddParameter("text/plain", "",  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Response

You will get back a user id and a session id that you will need to save to use in the other calls to Aikey.

{
  "message": "Success",
  "userId": "U.5d45af5fcb75f9.31319840",
  "sessionId": "S.6d45af5fcb7502.31319892"
}

If you want to use an already existing user in Aikey you can do so by adding 

curl https://api.aikey.io/v1/session/start \
--header 'X-CLIENTID: ClientId' \
--header 'X-SECRET: ClientSecret' \
--header "content-type: application/json" \
--data-raw '{
	"userId" : "U.5dce535fdafa85.72034206"
}'