#
Authorization
Gatekeepr API uses a token to authorize your request. You received your unique authorization key (named
within the documentation as [API_KEY]
) during the onboarding process.
To use the API, include your API key in the headers of all requests to the server, using the key Authorization
.
#
Testing Your Authorization Key
Use the code samples below to verify your authorization key. This request will be sent to the /ping
endpoint.
curl -H "X-Authorization: [API_KEY]" "https://api.gatekeepr.ro/ping"
try {
const res = await fetch("https://api.getkeepr.ro/ping", {
method: "GET",
headers: {
"X-Authorization": "[API_KEY]",
"Content-Type": "application/json"
}
})
const json = await res.json()
console.log(json)
} catch(err) {
console.log(err)
}
<?php
$apiUrl = "https://api.gatekeepr.ro/ping";
$apiKey = "[API_KEY]";
try {
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"X-Authorization: $apiKey",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
if(curl_errno($ch)) {
throw new Exception(curl_error($ch));
}
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if($httpCode !== 200) {
throw new Exception("Request failed with status code: $httpCode");
}
$json = json_decode($response, true);
print_r($json);
} catch(Exception $e) {
echo "Error: " . $e->getMessage();
}
If everything is set up correctly, you will receive this response:
{ "pong": true }