{"id":23,"date":"2026-10-22T19:03:53","date_gmt":"2026-10-22T17:03:53","guid":{"rendered":"https:\/\/demo.leitvia.com\/docs\/docs\/api\/"},"modified":"2026-10-22T19:03:53","modified_gmt":"2026-10-22T17:03:53","slug":"api","status":"publish","type":"page","link":"https:\/\/demo.leitvia.com\/docs\/docs\/api\/","title":{"rendered":"API reference"},"content":{"rendered":"<nav class=\"wp-block-leitvia-table-of-contents\" aria-labelledby=\"leitvia-toc-title\"><h2 id=\"leitvia-toc-title\" class=\"wp-block-leitvia-table-of-contents__title\">On this page<\/h2><ol><li><a href=\"#authentication\">Authentication<\/a><\/li><li><a href=\"#endpoints\">Endpoints<\/a><\/li><li><a href=\"#example-response\">Example response<\/a><\/li><li><a href=\"#errors\">Errors<\/a><\/li><\/ol><\/nav>\n\n<h2 class=\"wp-block-heading\">Authentication<\/h2>\n\n\n<p class=\"wp-block-paragraph\">Every request needs a token in the <code>Authorization<\/code> header. Create tokens with <code>lantern token create &lt;name&gt;<\/code>; Lantern shows each token once.<\/p>\n\n<div class=\"leitvia-code-copy\">\n<pre class=\"wp-block-code\"><code>curl -H &quot;Authorization: Bearer $LANTERN_API_TOKEN&quot; http:\/\/localhost:8080\/api\/v1\/checks<\/code><\/pre>\n<div class=\"leitvia-code-copy__bar\"><span class=\"leitvia-code-copy__status\" role=\"status\" data-copied=\"Copied\" data-failed=\"Copy failed, select the code and copy it manually\"><\/span><button type=\"button\" class=\"leitvia-code-copy__button\" hidden>Copy code<\/button><\/div><\/div>\n\n<h2 class=\"wp-block-heading\">Endpoints<\/h2>\n\n\n<figure tabindex=\"0\" class=\"wp-block-table\"><table><thead><tr><th>Method<\/th><th>Path<\/th><th>Result<\/th><\/tr><\/thead><tbody><tr><td>GET<\/td><td><code>\/api\/v1\/checks<\/code><\/td><td>All checks with their current state<\/td><\/tr><tr><td>GET<\/td><td><code>\/api\/v1\/checks\/{name}\/results<\/code><\/td><td>Results of one check, newest first, 100 per page<\/td><\/tr><tr><td>POST<\/td><td><code>\/api\/v1\/checks\/{name}\/pause<\/code><\/td><td>Pauses a check, for example during maintenance<\/td><\/tr><tr><td>POST<\/td><td><code>\/api\/v1\/checks\/{name}\/resume<\/code><\/td><td>Resumes a paused check<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n<h2 class=\"wp-block-heading\">Example response<\/h2>\n\n<div class=\"leitvia-code-copy\">\n<pre class=\"wp-block-code\"><code>{\n  &quot;checks&quot;: [\n    {\n      &quot;name&quot;: &quot;Website&quot;,\n      &quot;state&quot;: &quot;healthy&quot;,\n      &quot;last_run&quot;: &quot;2026-10-19T08:15:00Z&quot;,\n      &quot;response_ms&quot;: 182\n    }\n  ]\n}<\/code><\/pre>\n<div class=\"leitvia-code-copy__bar\"><span class=\"leitvia-code-copy__status\" role=\"status\" data-copied=\"Copied\" data-failed=\"Copy failed, select the code and copy it manually\"><\/span><button type=\"button\" class=\"leitvia-code-copy__button\" hidden>Copy code<\/button><\/div><\/div>\n\n<h2 class=\"wp-block-heading\">Errors<\/h2>\n\n\n<p class=\"wp-block-paragraph\">Errors use the usual HTTP status codes and a JSON body with <code>error<\/code> and <code>message<\/code>. A missing or wrong token gives 401, an unknown check 404.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>The REST API of Lantern: authentication, endpoints and examples with curl.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":8,"menu_order":5,"comment_status":"closed","ping_status":"closed","template":"page-docs","meta":{"_leitvia_easy_language_of":0,"footnotes":""},"class_list":["post-23","page","type-page","status-publish","hentry"],"leitvia_pattern_status":null,"_links":{"self":[{"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/pages\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/comments?post=23"}],"version-history":[{"count":1,"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/pages\/23\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/pages\/23\/revisions\/36"}],"up":[{"embeddable":true,"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/pages\/8"}],"wp:attachment":[{"href":"https:\/\/demo.leitvia.com\/docs\/wp-json\/wp\/v2\/media?parent=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}