You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

892 lines
59 KiB

4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <h1>Management API</h1>
  2. <p>With the Management API, you can programmatically manage checks and integrations
  3. in your account.</p>
  4. <h2>API Endpoints</h2>
  5. <table>
  6. <thead>
  7. <tr>
  8. <th>Endpoint Name</th>
  9. <th>Endpoint Address</th>
  10. </tr>
  11. </thead>
  12. <tbody>
  13. <tr>
  14. <td><a href="#list-checks">Get a list of existing checks</a></td>
  15. <td><code>GET SITE_ROOT/api/v1/checks/</code></td>
  16. </tr>
  17. <tr>
  18. <td><a href="#get-check">Get a single check</a></td>
  19. <td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code><br><code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></td>
  20. </tr>
  21. <tr>
  22. <td><a href="#create-check">Create a new check</a></td>
  23. <td><code>POST SITE_ROOT/api/v1/checks/</code></td>
  24. </tr>
  25. <tr>
  26. <td><a href="#update-check">Update an existing check</a></td>
  27. <td><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></td>
  28. </tr>
  29. <tr>
  30. <td><a href="#pause-check">Pause monitoring of a check</a></td>
  31. <td><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></td>
  32. </tr>
  33. <tr>
  34. <td><a href="#delete-check">Delete check</a></td>
  35. <td><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></td>
  36. </tr>
  37. <tr>
  38. <td><a href="#list-pings">Get a list of check's logged pings</a></td>
  39. <td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pings/</code></td>
  40. </tr>
  41. <tr>
  42. <td><a href="#list-flips">Get a list of check's status changes</a></td>
  43. <td><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code><br><code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;/flips/</code></td>
  44. </tr>
  45. <tr>
  46. <td><a href="#list-channels">Get a list of existing integrations</a></td>
  47. <td><code>GET SITE_ROOT/api/v1/channels/</code></td>
  48. </tr>
  49. <tr>
  50. <td><a href="#list-badges">Get project's badges</a></td>
  51. <td><code>GET SITE_ROOT/api/v1/badges/</code></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. <h2>Authentication</h2>
  56. <p>Your requests to SITE_NAME Management API must authenticate using an
  57. API key. All API keys are project-specific. There are no account-wide API keys.
  58. By default, a project on SITE_NAME doesn't have an API key. You can create read-write
  59. and read-only API keys on the <strong>Project Settings</strong> page.</p>
  60. <dl>
  61. <dt>read-write key</dt>
  62. <dd>Has full access to all documented API endpoints.</dd>
  63. <dt>read-only key</dt>
  64. <dd>
  65. <p>Only works with the following API endpoints:</p>
  66. <ul>
  67. <li><a href="#list-checks">Get a list of existing checks</a></li>
  68. <li><a href="#get-check">Get a single check</a></li>
  69. <li><a href="#list-flips">Get a list of check's status changes</a></li>
  70. <li><a href="#list-badges">Get project's badges</a></li>
  71. </ul>
  72. <p>Omits sensitive information from the API responses. See the documentation of
  73. individual API endpoints for details.</p>
  74. </dd>
  75. </dl>
  76. <p>The client can authenticate itself by including an <code>X-Api-Key: &lt;your-api-key&gt;</code>
  77. header in an HTTP request. Alternatively, for POST requests with a JSON request body,
  78. the client can put an <code>api_key</code> field in the JSON document.
  79. See the <a href="#create-check">Create a new check</a> section for an example.</p>
  80. <h2>API Requests</h2>
  81. <p>For POST requests, the SITE_NAME API expects the request body to be
  82. a JSON document (<em>not</em> a <code>multipart/form-data</code> encoded form data).</p>
  83. <h2>API Responses</h2>
  84. <p>SITE_NAME uses HTTP status codes wherever possible.
  85. In general, 2xx class indicates success, 4xx indicates a client error,
  86. and 5xx indicates a server error.</p>
  87. <p>The response may contain a JSON document with additional data.</p>
  88. <h2 class="rule" id="list-checks">Get a List of Existing Checks</h2>
  89. <p><code>GET SITE_ROOT/api/v1/checks/</code></p>
  90. <p>Returns a list of checks belonging to the user, optionally filtered by
  91. one or more tags.</p>
  92. <h3>Query String Parameters</h3>
  93. <dl>
  94. <dt>tag=&lt;value&gt;</dt>
  95. <dd>
  96. <p>Filters the checks and returns only the checks that are tagged with the
  97. specified value.</p>
  98. <p>This parameter can be repeated multiple times.</p>
  99. <p>Example:</p>
  100. <p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p>
  101. </dd>
  102. </dl>
  103. <h3>Response Codes</h3>
  104. <dl>
  105. <dt>200 OK</dt>
  106. <dd>The request succeeded.</dd>
  107. <dt>401 Unauthorized</dt>
  108. <dd>The API key is either missing or invalid.</dd>
  109. </dl>
  110. <h3>Example Request</h3>
  111. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/
  112. </code></pre></div>
  113. <h3>Example Response</h3>
  114. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  115. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  116. <span class="p">{</span>
  117. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Filesystem Backup&quot;</span><span class="p">,</span>
  118. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;filesystem-backup&quot;</span><span class="p">,</span>
  119. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;backup fs&quot;</span><span class="p">,</span>
  120. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs incremental backup every hour&quot;</span><span class="p">,</span>
  121. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">600</span><span class="p">,</span>
  122. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  123. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  124. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-24T14:02:03+00:00&quot;</span><span class="p">,</span>
  125. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-24T15:02:03+00:00&quot;</span><span class="p">,</span>
  126. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  127. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  128. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINT31365bce-8da9-4729-8ff3-aaa71d56b712&quot;</span><span class="p">,</span>
  129. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/31365bce-8da9-4729-8ff3-aaa71d56b712&quot;</span><span class="p">,</span>
  130. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/31365bce-8da9-4729-8ff3-aaa71d56b712/pause&quot;</span><span class="p">,</span>
  131. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c&quot;</span><span class="p">,</span>
  132. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  133. <span class="p">},</span>
  134. <span class="p">{</span>
  135. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  136. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;database-backup&quot;</span><span class="p">,</span>
  137. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  138. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs ~/db-backup.sh&quot;</span><span class="p">,</span>
  139. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  140. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  141. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  142. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:19:32+00:00&quot;</span><span class="p">,</span>
  143. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  144. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  145. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  146. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINT803f680d-e89b-492b-82ef-2be7b774a92d&quot;</span><span class="p">,</span>
  147. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d&quot;</span><span class="p">,</span>
  148. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause&quot;</span><span class="p">,</span>
  149. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c&quot;</span><span class="p">,</span>
  150. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  151. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  152. <span class="p">}</span>
  153. <span class="p">]</span>
  154. <span class="p">}</span>
  155. </code></pre></div>
  156. <p>The possible values for the <code>status</code> field are: <code>new</code>, <code>started</code>, <code>up</code>, <code>grace</code>, <code>down</code>,
  157. and <code>paused</code>.</p>
  158. <p>When using the read-only API key, SITE_NAME omits the following fields from responses:
  159. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. It adds an extra
  160. <code>unique_key</code> field. The <code>unique_key</code> identifier is stable across API calls, and
  161. you can use it in the <a href="#get-check">Get a single check</a>
  162. and <a href="#list-flips">Get a list of check's status changes</a> API calls.</p>
  163. <p>Example:</p>
  164. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  165. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  166. <span class="p">{</span>
  167. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Filesystem Backup&quot;</span><span class="p">,</span>
  168. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;filesystem-backup&quot;</span><span class="p">,</span>
  169. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;backup fs&quot;</span><span class="p">,</span>
  170. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs incremental backup every hour&quot;</span><span class="p">,</span>
  171. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">600</span><span class="p">,</span>
  172. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  173. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  174. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-24T14:02:03+00:00&quot;</span><span class="p">,</span>
  175. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-24T15:02:03+00:00&quot;</span><span class="p">,</span>
  176. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  177. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  178. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;a6c7b0a8a66bed0df66abfdab3c77736861703ee&quot;</span><span class="p">,</span>
  179. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  180. <span class="p">},</span>
  181. <span class="p">{</span>
  182. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  183. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;database-backup&quot;</span><span class="p">,</span>
  184. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  185. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs ~/db-backup.sh&quot;</span><span class="p">,</span>
  186. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  187. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  188. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  189. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:19:32+00:00&quot;</span><span class="p">,</span>
  190. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  191. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  192. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  193. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  194. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  195. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  196. <span class="p">}</span>
  197. <span class="p">]</span>
  198. <span class="p">}</span>
  199. </code></pre></div>
  200. <h2 class="rule" id="get-check">Get a Single Check</h2>
  201. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code><br>
  202. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></p>
  203. <p>Returns a JSON representation of a single check. Accepts either check's UUID or
  204. the <code>unique_key</code> (a field derived from UUID and returned by API responses when
  205. using the read-only API key) as an identifier.</p>
  206. <h3>Response Codes</h3>
  207. <dl>
  208. <dt>200 OK</dt>
  209. <dd>The request succeeded.</dd>
  210. <dt>401 Unauthorized</dt>
  211. <dd>The API key is either missing or invalid.</dd>
  212. <dt>403 Forbidden</dt>
  213. <dd>Access denied, wrong API key.</dd>
  214. <dt>404 Not Found</dt>
  215. <dd>The specified check does not exist.</dd>
  216. </dl>
  217. <h3>Example Request</h3>
  218. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/&lt;uuid&gt;
  219. </code></pre></div>
  220. <h3>Example Response</h3>
  221. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  222. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  223. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;database-backup&quot;</span><span class="p">,</span>
  224. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  225. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs ~/db-backup.sh&quot;</span><span class="p">,</span>
  226. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  227. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  228. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  229. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:19:32+00:00&quot;</span><span class="p">,</span>
  230. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  231. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  232. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  233. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINT803f680d-e89b-492b-82ef-2be7b774a92d&quot;</span><span class="p">,</span>
  234. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d&quot;</span><span class="p">,</span>
  235. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/803f680d-e89b-492b-82ef-2be7b774a92d/pause&quot;</span><span class="p">,</span>
  236. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;1bdea468-03bf-47b8-ab27-29a9dd0e4b94,51c6eb2b-2ae1-456b-99fe-6f1e0a36cd3c&quot;</span><span class="p">,</span>
  237. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  238. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  239. <span class="p">}</span>
  240. </code></pre></div>
  241. <p>The possible values for the <code>status</code> field are: <code>new</code>, <code>started</code>, <code>up</code>, <code>grace</code>, <code>down</code>,
  242. and <code>paused</code>.</p>
  243. <h3>Example Read-Only Response</h3>
  244. <p>When using the read-only API key, SITE_NAME omits the following fields from responses:
  245. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. It adds an extra
  246. <code>unique_key</code> field. This identifier is stable across API calls.</p>
  247. <p>Note: although API omits the <code>ping_url</code>, <code>update_url</code>, and <code>pause_url</code> in read-only
  248. API responses, the client can easily construct these URLs themselves <em>if</em> they know the
  249. check's unique UUID.</p>
  250. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  251. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  252. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;database-backup&quot;</span><span class="p">,</span>
  253. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  254. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Runs ~/db-backup.sh&quot;</span><span class="p">,</span>
  255. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  256. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  257. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  258. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:19:32+00:00&quot;</span><span class="p">,</span>
  259. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  260. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  261. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  262. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  263. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  264. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  265. <span class="p">}</span>
  266. </code></pre></div>
  267. <h2 class="rule" id="create-check">Create a Check</h2>
  268. <p><code>POST SITE_ROOT/api/v1/checks/</code></p>
  269. <p>Creates a new check and returns its ping URL.
  270. All request parameters are optional and will use their default
  271. values if omitted.</p>
  272. <p>With this API call, you can create both Simple and Cron checks:</p>
  273. <ul>
  274. <li>To create a Simple check, specify the <code>timeout</code> parameter.</li>
  275. <li>To create a Cron check, specify the <code>schedule</code> and <code>tz</code> parameters.</li>
  276. </ul>
  277. <h3>Request Parameters</h3>
  278. <dl>
  279. <dt>name</dt>
  280. <dd>
  281. <p>string, optional, default value: ""</p>
  282. <p>Name for the new check.</p>
  283. </dd>
  284. <dt>tags</dt>
  285. <dd>
  286. <p>string, optional, default value: ""</p>
  287. <p>A space-delimited list of tags for the new check.
  288. Example:</p>
  289. <p><pre>{"tags": "reports staging"}</pre></p>
  290. </dd>
  291. <dt>desc</dt>
  292. <dd>
  293. <p>string, optional.</p>
  294. <p>Description of the check.</p>
  295. </dd>
  296. <dt>timeout</dt>
  297. <dd>
  298. <p>number, optional, default value: {{ default_timeout }}.</p>
  299. <p>A number of seconds, the expected period of this check.</p>
  300. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  301. <p>Example for a 5-minute timeout:</p>
  302. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  303. </dd>
  304. <dt>grace</dt>
  305. <dd>
  306. <p>number, optional, default value: {{ default_grace }}.</p>
  307. <p>A number of seconds, the grace period for this check.</p>
  308. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  309. </dd>
  310. <dt>schedule</dt>
  311. <dd>
  312. <p>string, optional, default value: "<code>* * * * *</code>".</p>
  313. <p>A cron expression defining this check's schedule.</p>
  314. <p>If you specify both <code>timeout</code> and <code>schedule</code> parameters,
  315. SITE_NAME will create a Cron check and ignore
  316. the <code>timeout</code> value.</p>
  317. <p>Example for a check running every half-hour:</p>
  318. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  319. </dd>
  320. <dt>tz</dt>
  321. <dd>
  322. <p>string, optional, default value: "UTC".</p>
  323. <p>Server's timezone. This setting only has an effect in combination with the
  324. <code>schedule</code> parameter.</p>
  325. <p>Example:</p>
  326. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  327. </dd>
  328. <dt>manual_resume</dt>
  329. <dd>
  330. <p>boolean, optional, default value: false.</p>
  331. <p>Controls whether a paused check automatically resumes when pinged (the default)
  332. or not. If set to false, a paused check will leave the paused state when it receives
  333. a ping. If set to true, a paused check will ignore pings and stay paused until
  334. you manually resume it from the web dashboard.</p>
  335. </dd>
  336. <dt>methods</dt>
  337. <dd>
  338. <p>string, optional, default value: "".</p>
  339. <p>Specifies the allowed HTTP methods for making ping requests.
  340. Must be one of the two values: "" (an empty string) or "POST".</p>
  341. <p>Set this field to "" (an empty string) to allow HEAD, GET,
  342. and POST requests.</p>
  343. <p>Set this field to "POST" to allow only POST requests.</p>
  344. <p>Example:</p>
  345. <p><pre>{"methods": "POST"}</pre></p>
  346. </dd>
  347. <dt>channels</dt>
  348. <dd>
  349. <p>string, optional</p>
  350. <p>By default, this API call assigns no integrations to the newly created
  351. check.</p>
  352. <p>Set this field to a special value "*" to automatically assign all existing
  353. integrations. Example:</p>
  354. <p><pre>{"channels": "*"}</pre></p>
  355. <p>To assign specific integrations, use a comma-separated list of integration
  356. UUIDs. You can look up integration UUIDs using the
  357. <a href="#list-channels">Get a List of Existing Integrations</a> API call.</p>
  358. <p>Example:</p>
  359. <p><pre>{"channels":
  360. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  361. <p>Alternatively, if you have named your integrations in SITE_NAME dashboard,
  362. you can specify integrations by their names. For this to work, your integrations
  363. need non-empty unique names, and they must not contain commas.
  364. The names must match exactly, whitespace is significant.</p>
  365. <p>Example:</p>
  366. <p><pre>{"channels": "Email to Alice,SMS to Alice"}</pre></p>
  367. </dd>
  368. <dt>unique</dt>
  369. <dd>
  370. <p>array of string values, optional, default value: [].</p>
  371. <p>Enables "upsert" functionality. Before creating a check, SITE_NAME looks for
  372. existing checks, filtered by fields listed in <code>unique</code>.</p>
  373. <p>If SITE_NAME does not find a matching check, it creates a new check and returns it
  374. with the HTTP status code 201.</p>
  375. <p>If SITE_NAME finds a matching check, it updates the existing check and
  376. returns it with HTTP status code 200.</p>
  377. <p>The accepted values for the <code>unique</code> field are
  378. <code>name</code>, <code>tags</code>, <code>timeout</code>, and <code>grace</code>.</p>
  379. <p>Example:</p>
  380. <p><pre>{"name": "Backups", unique: ["name"]}</pre></p>
  381. <p>In this example, if a check named "Backups" exists, it will be returned.
  382. Otherwise, a new check will be created and returned.</p>
  383. </dd>
  384. </dl>
  385. <h3>Response Codes</h3>
  386. <dl>
  387. <dt>201 Created</dt>
  388. <dd>A new check was successfully created.</dd>
  389. <dt>200 OK</dt>
  390. <dd>An existing check was found and updated.</dd>
  391. <dt>400 Bad Request</dt>
  392. <dd>The request is not well-formed, violates schema, or uses invalid
  393. field values.</dd>
  394. <dt>401 Unauthorized</dt>
  395. <dd>The API key is either missing or invalid.</dd>
  396. <dt>403 Forbidden</dt>
  397. <dd>The account has hit its check limit. For free accounts,
  398. the limit is 20 checks per account.</dd>
  399. </dl>
  400. <h3>Example Request</h3>
  401. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  402. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  403. --data <span class="s1">&#39;{&quot;name&quot;: &quot;Backups&quot;, &quot;tags&quot;: &quot;prod www&quot;, &quot;timeout&quot;: 3600, &quot;grace&quot;: 60}&#39;</span>
  404. </code></pre></div>
  405. <p>Or, alternatively:</p>
  406. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  407. --data <span class="s1">&#39;{&quot;api_key&quot;: &quot;your-api-key&quot;, &quot;name&quot;: &quot;Backups&quot;, &quot;tags&quot;: &quot;prod www&quot;, &quot;timeout&quot;: 3600, &quot;grace&quot;: 60}&#39;</span>
  408. </code></pre></div>
  409. <h3>Example Response</h3>
  410. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  411. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  412. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  413. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  414. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  415. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  416. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  417. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;backups&quot;</span><span class="p">,</span>
  418. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  419. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  420. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  421. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause&quot;</span><span class="p">,</span>
  422. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  423. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  424. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  425. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  426. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  427. <span class="p">}</span>
  428. </code></pre></div>
  429. <h2 class="rule" id="update-check">Update an Existing Check</h2>
  430. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  431. <p>Updates an existing check. All request parameters are optional. If you omit any
  432. parameter, SITE_NAME will leave its value unchanged.</p>
  433. <h3>Request Parameters</h3>
  434. <dl>
  435. <dt>name</dt>
  436. <dd>
  437. <p>string, optional.</p>
  438. <p>Name for the check.</p>
  439. </dd>
  440. <dt>tags</dt>
  441. <dd>
  442. <p>string, optional.</p>
  443. <p>A space-delimited list of tags for the check.</p>
  444. <p>Example:</p>
  445. <p><pre>{"tags": "reports staging"}</pre></p>
  446. </dd>
  447. <dt>desc</dt>
  448. <dd>
  449. <p>string, optional.</p>
  450. <p>Description of the check.</p>
  451. </dd>
  452. <dt>timeout</dt>
  453. <dd>
  454. <p>number, optional.</p>
  455. <p>A number of seconds, the expected period of this check.</p>
  456. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  457. <p>Example for a 5-minute timeout:</p>
  458. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  459. </dd>
  460. <dt>grace</dt>
  461. <dd>
  462. <p>number, optional.</p>
  463. <p>A number of seconds, the grace period for this check.</p>
  464. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  465. </dd>
  466. <dt>schedule</dt>
  467. <dd>
  468. <p>string, optional.</p>
  469. <p>A cron expression defining this check's schedule.</p>
  470. <p>If you specify both <code>timeout</code> and <code>schedule</code> parameters,
  471. SITE_NAME will save the <code>schedule</code> parameter and ignore
  472. the <code>timeout</code>.</p>
  473. <p>Example for a check running every half-hour:</p>
  474. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  475. </dd>
  476. <dt>tz</dt>
  477. <dd>
  478. <p>string, optional.</p>
  479. <p>Server's timezone. This setting only has an effect in combination with the
  480. "schedule" parameter.</p>
  481. <p>Example:</p>
  482. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  483. </dd>
  484. <dt>manual_resume</dt>
  485. <dd>
  486. <p>boolean, optional, default value: false.</p>
  487. <p>Controls whether a paused ping automatically resumes when pinged (the default),
  488. or not. If set to false, a paused check will leave the paused state when it receives
  489. a ping. If set to true, a paused check will ignore pings and stay paused until
  490. you manually resume it from the web dashboard.</p>
  491. </dd>
  492. <dt>methods</dt>
  493. <dd>
  494. <p>string, optional, default value: "".</p>
  495. <p>Specifies the allowed HTTP methods for making ping requests.
  496. Must be one of the two values: "" (an empty string) or "POST".</p>
  497. <p>Set this field to "" (an empty string) to allow HEAD, GET,
  498. and POST requests.</p>
  499. <p>Set this field to "POST" to allow only POST requests.</p>
  500. <p>Example:</p>
  501. <p><pre>{"methods": "POST"}</pre></p>
  502. </dd>
  503. <dt>channels</dt>
  504. <dd>
  505. <p>string, optional.</p>
  506. <p>Set this field to a special value "*" to automatically assign all existing
  507. integrations. Example:</p>
  508. <p><pre>{"channels": "*"}</pre></p>
  509. <p>Set this field to a special value "" (empty string) to automatically <em>unassign</em>
  510. all existing integrations. Example:</p>
  511. <p><pre>{"channels": ""}</pre></p>
  512. <p>To assign specific integrations, use a comma-separated list of integration
  513. UUIDs. You can look up integration UUIDs using the
  514. <a href="#list-channels">Get a List of Existing Integrations</a> API call.</p>
  515. <p>Example:</p>
  516. <p><pre>{"channels":
  517. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  518. <p>Alternatively, if you have named your integrations in SITE_NAME dashboard,
  519. you can specify integrations by their names. For this to work, your integrations
  520. need non-empty and unique names, and they must not contain commas. The names
  521. must match exactly, whitespace is significant.</p>
  522. <p>Example:</p>
  523. <p><pre>{"channels": "Email to Alice,SMS to Alice"}</pre></p>
  524. </dd>
  525. </dl>
  526. <h3>Response Codes</h3>
  527. <dl>
  528. <dt>200 OK</dt>
  529. <dd>The check was successfully updated.</dd>
  530. <dt>400 Bad Request</dt>
  531. <dd>The request is not well-formed, violates schema, or uses invalid
  532. field values.</dd>
  533. <dt>401 Unauthorized</dt>
  534. <dd>The API key is either missing or invalid.</dd>
  535. <dt>403 Forbidden</dt>
  536. <dd>Access denied, wrong API key.</dd>
  537. <dt>404 Not Found</dt>
  538. <dd>The specified check does not exist.</dd>
  539. </dl>
  540. <h3>Example Request</h3>
  541. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  542. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  543. --data <span class="s1">&#39;{&quot;name&quot;: &quot;Backups&quot;, &quot;tags&quot;: &quot;prod www&quot;, &quot;timeout&quot;: 3600, &quot;grace&quot;: 60}&#39;</span>
  544. </code></pre></div>
  545. <p>Or, alternatively:</p>
  546. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  547. --data <span class="s1">&#39;{&quot;api_key&quot;: &quot;your-api-key&quot;, &quot;name&quot;: &quot;Backups&quot;, &quot;tags&quot;: &quot;prod www&quot;, &quot;timeout&quot;: 3600, &quot;grace&quot;: 60}&#39;</span>
  548. </code></pre></div>
  549. <h3>Example Response</h3>
  550. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  551. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  552. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  553. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  554. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  555. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  556. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  557. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;backups&quot;</span><span class="p">,</span>
  558. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  559. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  560. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  561. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause&quot;</span><span class="p">,</span>
  562. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  563. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  564. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  565. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  566. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  567. <span class="p">}</span>
  568. </code></pre></div>
  569. <h2 class="rule" id="pause-check">Pause Monitoring of a Check</h2>
  570. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></p>
  571. <p>Disables monitoring for a check without removing it. The check goes into a "paused"
  572. state. You can resume monitoring of the check by pinging it.</p>
  573. <p>This API call has no request parameters.</p>
  574. <h3>Response Codes</h3>
  575. <dl>
  576. <dt>200 OK</dt>
  577. <dd>The check was successfully paused.</dd>
  578. <dt>401 Unauthorized</dt>
  579. <dd>The API key is either missing or invalid.</dd>
  580. <dt>403 Forbidden</dt>
  581. <dd>Access denied, wrong API key.</dd>
  582. <dt>404 Not Found</dt>
  583. <dd>The specified check does not exist.</dd>
  584. </dl>
  585. <h3>Example Request</h3>
  586. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span>
  587. --request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span>
  588. </code></pre></div>
  589. <p>Note: the <code>--data ""</code> argument forces curl to send a <code>Content-Length</code> request header
  590. even though the request body is empty. For HTTP POST requests, the <code>Content-Length</code>
  591. header is sometimes required by some network proxies and web servers.</p>
  592. <h3>Example Response</h3>
  593. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  594. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  595. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  596. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  597. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  598. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  599. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  600. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;backups&quot;</span><span class="p">,</span>
  601. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  602. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  603. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  604. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause&quot;</span><span class="p">,</span>
  605. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  606. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;paused&quot;</span><span class="p">,</span>
  607. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  608. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  609. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc&quot;</span>
  610. <span class="p">}</span>
  611. </code></pre></div>
  612. <h2 class="rule" id="delete-check">Delete Check</h2>
  613. <p><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  614. <p>Permanently deletes the check from the user's account. Returns JSON representation of the
  615. check that was just deleted.</p>
  616. <p>This API call has no request parameters.</p>
  617. <h3>Response Codes</h3>
  618. <dl>
  619. <dt>200 OK</dt>
  620. <dd>The check was successfully deleted.</dd>
  621. <dt>401 Unauthorized</dt>
  622. <dd>The API key is either missing or invalid.</dd>
  623. <dt>403 Forbidden</dt>
  624. <dd>Access denied, wrong API key.</dd>
  625. <dt>404 Not Found</dt>
  626. <dd>The specified check does not exist.</dd>
  627. </dl>
  628. <h3>Example Request</h3>
  629. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  630. --request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  631. </code></pre></div>
  632. <h3>Example Response</h3>
  633. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  634. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  635. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  636. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  637. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  638. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  639. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  640. <span class="nt">&quot;slug&quot;</span><span class="p">:</span> <span class="s2">&quot;backups&quot;</span><span class="p">,</span>
  641. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  642. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  643. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  644. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pause&quot;</span><span class="p">,</span>
  645. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINTf618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  646. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  647. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  648. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  649. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc&quot;</span><span class="p">,</span>
  650. <span class="p">}</span>
  651. </code></pre></div>
  652. <h2 class="rule" id="list-pings">Get a list of check's logged pings</h2>
  653. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pings/</code></p>
  654. <p>Returns a list of pings this check has received.</p>
  655. <p>This endpoint returns pings in reverse order (most recent first), and the total
  656. number of returned pings depends on the account's billing plan: 100 for free accounts,
  657. 1000 for paid accounts.</p>
  658. <h3>Response Codes</h3>
  659. <dl>
  660. <dt>200 OK</dt>
  661. <dd>The request succeeded.</dd>
  662. <dt>401 Unauthorized</dt>
  663. <dd>The API key is either missing or invalid.</dd>
  664. <dt>403 Forbidden</dt>
  665. <dd>Access denied, wrong API key.</dd>
  666. <dt>404 Not Found</dt>
  667. <dd>The specified check does not exist.</dd>
  668. </dl>
  669. <h3>Example Request</h3>
  670. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pings/ <span class="se">\</span>
  671. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  672. </code></pre></div>
  673. <h3>Example Response</h3>
  674. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  675. <span class="nt">&quot;pings&quot;</span><span class="p">:</span> <span class="p">[</span>
  676. <span class="p">{</span>
  677. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;success&quot;</span><span class="p">,</span>
  678. <span class="nt">&quot;date&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-06-09T14:51:06.113073+00:00&quot;</span><span class="p">,</span>
  679. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
  680. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  681. <span class="nt">&quot;remote_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;192.0.2.0&quot;</span><span class="p">,</span>
  682. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  683. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span><span class="p">,</span>
  684. <span class="nt">&quot;duration&quot;</span><span class="p">:</span> <span class="mf">2.896736</span>
  685. <span class="p">},</span>
  686. <span class="p">{</span>
  687. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span>
  688. <span class="nt">&quot;date&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-06-09T14:51:03.216337+00:00&quot;</span><span class="p">,</span>
  689. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
  690. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  691. <span class="nt">&quot;remote_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;192.0.2.0&quot;</span><span class="p">,</span>
  692. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  693. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span>
  694. <span class="p">},</span>
  695. <span class="p">{</span>
  696. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;success&quot;</span><span class="p">,</span>
  697. <span class="nt">&quot;date&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-06-09T14:50:59.633577+00:00&quot;</span><span class="p">,</span>
  698. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
  699. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  700. <span class="nt">&quot;remote_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;192.0.2.0&quot;</span><span class="p">,</span>
  701. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  702. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span><span class="p">,</span>
  703. <span class="nt">&quot;duration&quot;</span><span class="p">:</span> <span class="mf">2.997976</span>
  704. <span class="p">},</span>
  705. <span class="p">{</span>
  706. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span>
  707. <span class="nt">&quot;date&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-06-09T14:50:56.635601+00:00&quot;</span><span class="p">,</span>
  708. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  709. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  710. <span class="nt">&quot;remote_addr&quot;</span><span class="p">:</span> <span class="s2">&quot;192.0.2.0&quot;</span><span class="p">,</span>
  711. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  712. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span>
  713. <span class="p">}</span>
  714. <span class="p">]</span>
  715. <span class="p">}</span>
  716. </code></pre></div>
  717. <h2 class="rule" id="list-flips">Get a list of check's status changes</h2>
  718. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code><br>
  719. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;/flips/</code></p>
  720. <p>Returns a list of "flips" this check has experienced. A flip is a change of status
  721. (from "down" to "up," or from "up" to "down").</p>
  722. <h3>Query String Parameters</h3>
  723. <dl>
  724. <dt>seconds=&lt;value&gt;</dt>
  725. <dd>
  726. <p>Returns the flips from the last <code>value</code> seconds</p>
  727. <p>Example:</p>
  728. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?seconds=3600</code></p>
  729. </dd>
  730. <dt>start=&lt;value&gt;</dt>
  731. <dd>
  732. <p>Returns flips that are newer than the specified UNIX timestamp.</p>
  733. <p>Example:</p>
  734. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?start=1592214380</code></p>
  735. </dd>
  736. <dt>end=&lt;value&gt;</dt>
  737. <dd>
  738. <p>Returns flips that are older than the specified UNIX timestamp.</p>
  739. <p>Example:</p>
  740. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?end=1592217980</code></p>
  741. </dd>
  742. </dl>
  743. <h3>Response Codes</h3>
  744. <dl>
  745. <dt>200 OK</dt>
  746. <dd>The request succeeded.</dd>
  747. <dt>400 Bad Request</dt>
  748. <dd>Invalid query parameters.</dd>
  749. <dt>401 Unauthorized</dt>
  750. <dd>The API key is either missing or invalid.</dd>
  751. <dt>403 Forbidden</dt>
  752. <dd>Access denied, wrong API key.</dd>
  753. <dt>404 Not Found</dt>
  754. <dd>The specified check does not exist.</dd>
  755. </dl>
  756. <h3>Example Request</h3>
  757. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/flips/ <span class="se">\</span>
  758. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  759. </code></pre></div>
  760. <h3>Example Response</h3>
  761. <div class="highlight"><pre><span></span><code><span class="p">[</span>
  762. <span class="p">{</span>
  763. <span class="nt">&quot;timestamp&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:18:23+00:00&quot;</span><span class="p">,</span>
  764. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  765. <span class="p">},</span>
  766. <span class="p">{</span>
  767. <span class="nt">&quot;timestamp&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:17:15+00:00&quot;</span><span class="p">,</span>
  768. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">0</span>
  769. <span class="p">},</span>
  770. <span class="p">{</span>
  771. <span class="nt">&quot;timestamp&quot;</span><span class="p">:</span> <span class="s2">&quot;2020-03-23T10:16:18+00:00&quot;</span><span class="p">,</span>
  772. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  773. <span class="p">}</span>
  774. <span class="p">]</span>
  775. </code></pre></div>
  776. <h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2>
  777. <p><code>GET SITE_ROOT/api/v1/channels/</code></p>
  778. <p>Returns a list of integrations belonging to the project.</p>
  779. <h3>Response Codes</h3>
  780. <dl>
  781. <dt>200 OK</dt>
  782. <dd>The request succeeded.</dd>
  783. <dt>401 Unauthorized</dt>
  784. <dd>The API key is either missing or invalid.</dd>
  785. </dl>
  786. <h3>Example Request</h3>
  787. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/channels/
  788. </code></pre></div>
  789. <h3>Example Response</h3>
  790. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  791. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="p">[</span>
  792. <span class="p">{</span>
  793. <span class="nt">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;4ec5a071-2d08-4baa-898a-eb4eb3cd6941&quot;</span><span class="p">,</span>
  794. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Work Email&quot;</span><span class="p">,</span>
  795. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;email&quot;</span>
  796. <span class="p">},</span>
  797. <span class="p">{</span>
  798. <span class="nt">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;746a083e-f542-4554-be1a-707ce16d3acc&quot;</span><span class="p">,</span>
  799. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Phone&quot;</span><span class="p">,</span>
  800. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;sms&quot;</span>
  801. <span class="p">}</span>
  802. <span class="p">]</span>
  803. <span class="p">}</span>
  804. </code></pre></div>
  805. <h2 class="rule" id="list-badges">Get Project's Badges</h2>
  806. <p><code>GET SITE_ROOT/api/v1/badges/</code></p>
  807. <p>Returns a map of all tags in the project, with badge URLs for each tag. SITE_NAME
  808. provides badges in a few different formats:</p>
  809. <ul>
  810. <li><code>svg</code>: returns the badge as a SVG document.</li>
  811. <li><code>json</code>: returns a JSON document which you can use to generate a custom badge
  812. yourself.</li>
  813. <li><code>shields</code>: returns JSON in a <a href="https://shields.io/endpoint">Shields.io compatible format</a>.</li>
  814. </ul>
  815. <p>In addition, badges have 2-state and 3-state variations:</p>
  816. <ul>
  817. <li><code>svg</code>, <code>json</code>, <code>shields</code>: reports two states: "up" and "down". It
  818. considers any checks in the grace period as still "up".</li>
  819. <li><code>svg3</code>, <code>json3</code>, <code>shields3</code>: reports three states: "up", "late", and "down".</li>
  820. </ul>
  821. <p>The response includes a special <code>*</code> entry: this pseudo-tag reports the overal status
  822. of all checks in the project.</p>
  823. <h3>Response Codes</h3>
  824. <dl>
  825. <dt>200 OK</dt>
  826. <dd>The request succeeded.</dd>
  827. <dt>401 Unauthorized</dt>
  828. <dd>The API key is either missing or invalid.</dd>
  829. </dl>
  830. <h3>Example Request</h3>
  831. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/badges/
  832. </code></pre></div>
  833. <h3>Example Response</h3>
  834. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  835. <span class="nt">&quot;badges&quot;</span><span class="p">:</span> <span class="p">{</span>
  836. <span class="nt">&quot;backup&quot;</span><span class="p">:</span> <span class="p">{</span>
  837. <span class="nt">&quot;svg&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.svg&quot;</span><span class="p">,</span>
  838. <span class="nt">&quot;svg3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.svg&quot;</span><span class="p">,</span>
  839. <span class="nt">&quot;json&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.json&quot;</span><span class="p">,</span>
  840. <span class="nt">&quot;json3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.json&quot;</span><span class="p">,</span>
  841. <span class="nt">&quot;shields&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M-2/backup.shields&quot;</span><span class="p">,</span>
  842. <span class="nt">&quot;shields3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/LOegDs5M/backup.shields&quot;</span>
  843. <span class="p">},</span>
  844. <span class="nt">&quot;db&quot;</span><span class="p">:</span> <span class="p">{</span>
  845. <span class="nt">&quot;svg&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.svg&quot;</span><span class="p">,</span>
  846. <span class="nt">&quot;svg3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.svg&quot;</span><span class="p">,</span>
  847. <span class="nt">&quot;json&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.json&quot;</span><span class="p">,</span>
  848. <span class="nt">&quot;json3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.json&quot;</span><span class="p">,</span>
  849. <span class="nt">&quot;shields&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm-2/db.shields&quot;</span><span class="p">,</span>
  850. <span class="nt">&quot;shields3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/99MuQaKm/db.shields&quot;</span>
  851. <span class="p">},</span>
  852. <span class="nt">&quot;prod&quot;</span><span class="p">:</span> <span class="p">{</span>
  853. <span class="nt">&quot;svg&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.svg&quot;</span><span class="p">,</span>
  854. <span class="nt">&quot;svg3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.svg&quot;</span><span class="p">,</span>
  855. <span class="nt">&quot;json&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.json&quot;</span><span class="p">,</span>
  856. <span class="nt">&quot;json3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.json&quot;</span><span class="p">,</span>
  857. <span class="nt">&quot;shields&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8-2/prod.shields&quot;</span><span class="p">,</span>
  858. <span class="nt">&quot;shields3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/1TEhqie8/prod.shields&quot;</span>
  859. <span class="p">},</span>
  860. <span class="nt">&quot;*&quot;</span><span class="p">:</span> <span class="p">{</span>
  861. <span class="nt">&quot;svg&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.svg&quot;</span><span class="p">,</span>
  862. <span class="nt">&quot;svg3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.svg&quot;</span><span class="p">,</span>
  863. <span class="nt">&quot;json&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.json&quot;</span><span class="p">,</span>
  864. <span class="nt">&quot;json3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.json&quot;</span><span class="p">,</span>
  865. <span class="nt">&quot;shields&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe-2.shields&quot;</span><span class="p">,</span>
  866. <span class="nt">&quot;shields3&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/badge/67541b37-8b9c-4d17-b952-690eae/9X7kcZoe.shields&quot;</span>
  867. <span class="p">}</span>
  868. <span class="p">}</span>
  869. <span class="p">}</span>
  870. </code></pre></div>