function createApiKey(array $keyDetails)
{
    $api = new AVRSAPI();
    $api->setMethod('POST');
    $api->setURL('/api/v1.5/apiauthkeys/');
    foreach ($keyDetails as $key => $value) {
        $api->addPayload($key, $value);
    }
    $api->send();
    $httpInfo = $api->getInfo();
    $results = json_decode($api->getResult(), true);
    if ($httpInfo['http_code'] != 200) {
        print_r($results);
        throw new \Exception('Unable to create API key.  Received http error code: ' . $httpInfo['http_code']);
    }
    if (isset($results['keys'][0]) && is_array($results['keys'][0])) {
        return $results['keys'][0];
    }
    return [];
}