Running checks
Start a check, then follow it until the report is ready.
On the Agency plan
Which sites
A key can check your plan's site, or your clients' sites on Agency.
Start one
Put your site in place of YOUR_SITE, written the way it appears on My sites, such as example.com. It has to be a site your plan covers.
Terminal
curl -X POST -H "Authorization: Bearer $CLEARREADOUT_KEY" -H "Content-Type: application/json" -d '{"site": "YOUR_SITE"}' https://app.clearreadout.com/api/v1/checksPython
Python
import json, os, urllib.request
req = urllib.request.Request(
"https://app.clearreadout.com/api/v1/checks",
data=json.dumps({"site": "YOUR_SITE"}).encode(),
method="POST",
headers={"Authorization": "Bearer " + os.environ["CLEARREADOUT_KEY"],
"Content-Type": "application/json"},
)
with urllib.request.urlopen(req) as resp:
print(json.load(resp))Node
Node
const res = await fetch("https://app.clearreadout.com/api/v1/checks", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CLEARREADOUT_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"site": "YOUR_SITE"}),
});
console.log(res.status, await res.json());PHP
PHP
<?php
$ch = curl_init("https://app.clearreadout.com/api/v1/checks");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("CLEARREADOUT_KEY"), "Content-Type: application/json"],
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(["site" => "YOUR_SITE"]),
CURLOPT_RETURNTRANSFER => true,
]);
$answer = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $answer;The answer is a 202 with the check's id:
Response
{"id": "3f9c2a7e5b1d8046", "state": "reading_pages"}Follow it
Put that id in place of CHECK_ID and ask again every few seconds.
Terminal
curl -H "Authorization: Bearer $CLEARREADOUT_KEY" https://app.clearreadout.com/api/v1/checks/CHECK_IDPython
Python
import json, os, urllib.request
req = urllib.request.Request(
"https://app.clearreadout.com/api/v1/checks/CHECK_ID",
headers={"Authorization": "Bearer " + os.environ["CLEARREADOUT_KEY"]},
)
with urllib.request.urlopen(req) as resp:
print(json.load(resp))Node
Node
const res = await fetch("https://app.clearreadout.com/api/v1/checks/CHECK_ID", {
headers: { Authorization: `Bearer ${process.env.CLEARREADOUT_KEY}` },
});
console.log(res.status, await res.json());PHP
PHP
<?php
$ch = curl_init("https://app.clearreadout.com/api/v1/checks/CHECK_ID");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("CLEARREADOUT_KEY")],
CURLOPT_RETURNTRANSFER => true,
]);
$answer = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $answer;States
reading_pagesWe're finding the site's pages.checkingPages are being checked. Includespages_doneandpages_total.doneFinished. Includesreport_id.
A check can also end here
failedIt stopped. Includesreason.expiredThe check is too old to follow.
How long it takes
A whole-site check can take up to twenty minutes. Two ways to know it's finished:
- Ask until it's donePoll
/api/v1/checks/{id}and readstate. - Let us tell youAdd a webhook and we send the report the moment it's ready.