How to get Toky agents list

Learn how to get a list of your Toky agents using our API


API Endpoint used


Parameters you need to replace in the getTokyAgents function:

function getTokyAgents()
    // create a new cURL resource
    $ch = curl_init();
		$api_key = '[[TOKY_API_KEY]]';
    $headers = array();
    $headers[] = "X-Toky-Key: {$api_key}";
    // set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, "");
    curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
    $curl_response = curl_exec($ch); // Send request
  	curl_close($ch); // close cURL resource 
		return json_decode($curl_response,true);
    $agents = getTokyAgents();
    $agentsNumber = sizeof($agents);
    print "Loaded $agentsNumber agents: "; var_export($agents);