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.

768 lines
47 KiB

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
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>SITE_NAME Management API supports listing, creating, updating, pausing and deleting
  3. checks in user's 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. </tbody>
  50. </table>
  51. <h2>Authentication</h2>
  52. <p>Your requests to SITE_NAME Management API must authenticate using an
  53. API key. API keys are project-specific, there are no account-wide API keys.
  54. By default, a project on SITE_NAME doesn't have an API key. You can create read-write
  55. and read-only API keys in the <strong>Project Settings</strong> page.</p>
  56. <dl>
  57. <dt>read-write key</dt>
  58. <dd>Has full access to all documented API endpoints.</dd>
  59. <dt>read-only key</dt>
  60. <dd>
  61. <p>Only works with the following API endpoints:</p>
  62. <ul>
  63. <li><a href="#list-checks">Get a list of existing checks</a></li>
  64. <li><a href="#get-check">Get a single check</a></li>
  65. <li><a href="#list-flips">Get a list of check's status changes</a></li>
  66. </ul>
  67. <p>Omits sensitive information from the API responses. See the documentation of
  68. individual API endpoints for details.</p>
  69. </dd>
  70. </dl>
  71. <p>The client can authenticate itself by including an <code>X-Api-Key: &lt;your-api-key&gt;</code>
  72. header in a HTTP request. Alternatively, for POST requests with a JSON request body,
  73. the client can include an <code>api_key</code> field in the JSON document.
  74. See the <a href="#create-check">Create a new check</a> section for an example.</p>
  75. <h2>API Requests</h2>
  76. <p>For POST requests, the SITE_NAME API expects request body to be
  77. a JSON document (<em>not</em> a <code>multipart/form-data</code> encoded form data).</p>
  78. <h2>API Responses</h2>
  79. <p>SITE_NAME uses HTTP status codes wherever possible.
  80. In general, 2xx class indicates success, 4xx indicates an client error,
  81. and 5xx indicates a server error.</p>
  82. <p>The response may contain a JSON document with additional data.</p>
  83. <h2 class="rule" id="list-checks">Get a List of Existing Checks</h2>
  84. <p><code>GET SITE_ROOT/api/v1/checks/</code></p>
  85. <p>Returns a list of checks belonging to the user, optionally filtered by
  86. one or more tags.</p>
  87. <h3>Query String Parameters</h3>
  88. <dl>
  89. <dt>tag=&lt;value&gt;</dt>
  90. <dd>
  91. <p>Filters the checks, and returns only the checks that are tagged with the
  92. specified value.</p>
  93. <p>This parameter can be repeated multiple times.</p>
  94. <p>Example:</p>
  95. <p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p>
  96. </dd>
  97. </dl>
  98. <h3>Response Codes</h3>
  99. <dl>
  100. <dt>200 OK</dt>
  101. <dd>The request succeeded.</dd>
  102. <dt>401 Unauthorized</dt>
  103. <dd>The API key is either missing or invalid.</dd>
  104. </dl>
  105. <h3>Example Request</h3>
  106. <div class="bash highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/
  107. </code></pre></div>
  108. <h3>Example Response</h3>
  109. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  110. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  111. <span class="p">{</span>
  112. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Filesystem Backup&quot;</span><span class="p">,</span>
  113. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;backup fs&quot;</span><span class="p">,</span>
  114. <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>
  115. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">600</span><span class="p">,</span>
  116. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  117. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  118. <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>
  119. <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>
  120. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  121. <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>
  122. <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>
  123. <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>
  124. <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>
  125. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  126. <span class="p">},</span>
  127. <span class="p">{</span>
  128. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  129. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  130. <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>
  131. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  132. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  133. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  134. <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>
  135. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  136. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  137. <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>
  138. <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>
  139. <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>
  140. <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>
  141. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  142. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  143. <span class="p">}</span>
  144. <span class="p">]</span>
  145. <span class="p">}</span>
  146. </code></pre></div>
  147. <p>When using the read-only API key, the following fields are omitted:
  148. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. An extra <code>unique_key</code> field
  149. is added which can be used <a href="#get-check">to <code>GET</code> a check</a> in place of the <code>UUID</code>. The <code>unique_key</code> identifier is stable across API calls. Example:</p>
  150. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  151. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  152. <span class="p">{</span>
  153. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Filesystem Backup&quot;</span><span class="p">,</span>
  154. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;backup fs&quot;</span><span class="p">,</span>
  155. <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>
  156. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">600</span><span class="p">,</span>
  157. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  158. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  159. <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>
  160. <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>
  161. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  162. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;a6c7b0a8a66bed0df66abfdab3c77736861703ee&quot;</span><span class="p">,</span>
  163. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  164. <span class="p">},</span>
  165. <span class="p">{</span>
  166. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  167. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  168. <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>
  169. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  170. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  171. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  172. <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>
  173. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  174. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  175. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  176. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  177. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  178. <span class="p">}</span>
  179. <span class="p">]</span>
  180. <span class="p">}</span>
  181. </code></pre></div>
  182. <h2 class="rule" id="get-check">Get a Single Check</h2>
  183. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code><br>
  184. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></p>
  185. <p>Returns a JSON representation of a single check. Accepts either check's UUID or
  186. the <code>unique_key</code> (a field derived from UUID, and returned by API responses when
  187. using the read-only API key) as an identifier.</p>
  188. <h3>Response Codes</h3>
  189. <dl>
  190. <dt>200 OK</dt>
  191. <dd>The request succeeded.</dd>
  192. <dt>401 Unauthorized</dt>
  193. <dd>The API key is either missing or invalid.</dd>
  194. <dt>403 Forbidden</dt>
  195. <dd>Access denied, wrong API key.</dd>
  196. <dt>404 Not Found</dt>
  197. <dd>The specified check does not exist.</dd>
  198. </dl>
  199. <h3>Example Request</h3>
  200. <div class="bash 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;
  201. </code></pre></div>
  202. <h3>Example Response</h3>
  203. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  204. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  205. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  206. <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>
  207. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  208. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  209. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  210. <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>
  211. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  212. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  213. <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>
  214. <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>
  215. <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>
  216. <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>
  217. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  218. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  219. <span class="p">}</span>
  220. </code></pre></div>
  221. <h3>Example Read-Only Response</h3>
  222. <p>When using the read-only API key, the following fields are omitted:
  223. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. An extra <code>unique_key</code> field is
  224. added. This identifier is stable across API calls.</p>
  225. <p>Note: the <code>ping_url</code>, <code>update_url</code> and <code>pause_url</code> fields, although omitted, are not
  226. really secret. The client already knows the check's unique UUID and so can easily
  227. construct these URLs by itself.</p>
  228. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  229. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  230. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  231. <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>
  232. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  233. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  234. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  235. <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>
  236. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  237. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  238. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  239. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  240. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  241. <span class="p">}</span>
  242. </code></pre></div>
  243. <h2 class="rule" id="create-check">Create a Check</h2>
  244. <p><code>POST SITE_ROOT/api/v1/checks/</code></p>
  245. <p>Creates a new check and returns its ping URL.
  246. All request parameters are optional and will use their default
  247. values if omitted.</p>
  248. <p>This API call can be used to create both "simple" and "cron" checks.
  249. To create a "simple" check, specify the "timeout" parameter.
  250. To create a "cron" check, specify the "schedule" and "tz" parameters.</p>
  251. <h3>Request Parameters</h3>
  252. <dl>
  253. <dt>name</dt>
  254. <dd>
  255. <p>string, optional, default value: ""</p>
  256. <p>Name for the new check.</p>
  257. </dd>
  258. <dt>tags</dt>
  259. <dd>
  260. <p>string, optional, default value: ""</p>
  261. <p>A space-delimited list of tags for the new check.
  262. Example:</p>
  263. <p><pre>{"tags": "reports staging"}</pre></p>
  264. </dd>
  265. <dt>desc</dt>
  266. <dd>
  267. <p>string, optional.</p>
  268. <p>Description for the check.</p>
  269. </dd>
  270. <dt>timeout</dt>
  271. <dd>
  272. <p>number, optional, default value: {{ default_timeout }}.</p>
  273. <p>A number of seconds, the expected period of this check.</p>
  274. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  275. <p>Example for 5 minute timeout:</p>
  276. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  277. </dd>
  278. <dt>grace</dt>
  279. <dd>
  280. <p>number, optional, default value: {{ default_grace }}.</p>
  281. <p>A number of seconds, the grace period for this check.</p>
  282. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  283. </dd>
  284. <dt>schedule</dt>
  285. <dd>
  286. <p>string, optional, default value: "<em> * </em> * *".</p>
  287. <p>A cron expression defining this check's schedule.</p>
  288. <p>If you specify both "timeout" and "schedule" parameters, "timeout" will be
  289. ignored and "schedule" will be used.</p>
  290. <p>Example for a check running every half-hour:</p>
  291. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  292. </dd>
  293. <dt>tz</dt>
  294. <dd>
  295. <p>string, optional, default value: "UTC".</p>
  296. <p>Server's timezone. This setting only has effect in combination with the
  297. "schedule" parameter.</p>
  298. <p>Example:</p>
  299. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  300. </dd>
  301. <dt>manual_resume</dt>
  302. <dd>
  303. <p>boolean, optional, default value: false.</p>
  304. <p>Controls whether a paused ping resumes automatically when pinged (the default),
  305. or not. If set to false, a paused check will leave the paused state when it receives
  306. a ping. If set to true, a paused check will ignore pings and stay paused until it is
  307. either manually resumed from the web dashboard or the <code>manual_resume</code> flag is
  308. changed.</p>
  309. </dd>
  310. <dt>channels</dt>
  311. <dd>
  312. <p>string, optional</p>
  313. <p>By default, if a check is created through API, no notification channels
  314. (integrations) are assigned to it. So, when the check goes up or down, no
  315. notifications will get sent.</p>
  316. <p>Set this field to a special value "*" to automatically assign all existing
  317. integrations.</p>
  318. <p>To assign specific integrations, use a comma-separated list of integration
  319. identifiers. Use the <a href="#list-channels">Get a List of Existing Integrations</a> call to
  320. look up integration identifiers.</p>
  321. </dd>
  322. <dt>unique</dt>
  323. <dd>
  324. <p>array of string values, optional, default value: [].</p>
  325. <p>Before creating a check, look for existing checks, filtered by fields listed
  326. in <code>unique</code>. If a matching check is found, return it with HTTP status code 200.
  327. If no matching check is found, proceed as normal: create a check and return it
  328. with HTTP status code 201.</p>
  329. <p>The accepted values are: <code>name</code>, <code>tags</code>, <code>timeout</code> and <code>grace</code>.</p>
  330. <p>Example:</p>
  331. <p><pre>{"name": "Backups", unique: ["name"]}</pre></p>
  332. <p>In this example, if a check named "Backups" exists, it will be returned.
  333. Otherwise, a new check will be created and returned.</p>
  334. </dd>
  335. </dl>
  336. <h3>Response Codes</h3>
  337. <dl>
  338. <dt>201 Created</dt>
  339. <dd>The check was successfully created.</dd>
  340. <dt>200 OK</dt>
  341. <dd>The <code>unique</code> parameter was used and an existing check was matched.</dd>
  342. <dt>400 Bad Request</dt>
  343. <dd>The request is not well-formed, violates schema, or uses invalid
  344. field values.</dd>
  345. <dt>401 Unauthorized</dt>
  346. <dd>The API key is either missing or invalid.</dd>
  347. <dt>403 Forbidden</dt>
  348. <dd>The account's check limit has been reached. For free accounts,
  349. the limit is 20 checks per account.</dd>
  350. </dl>
  351. <h3>Example Request</h3>
  352. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  353. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  354. --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>
  355. </code></pre></div>
  356. <p>Or, alternatively:</p>
  357. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  358. --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>
  359. </code></pre></div>
  360. <h3>Example Response</h3>
  361. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  362. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  363. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  364. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  365. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  366. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  367. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  368. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  369. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  370. <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>
  371. <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>
  372. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  373. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  374. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  375. <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>
  376. <span class="p">}</span>
  377. </code></pre></div>
  378. <h2 class="rule" id="update-check">Update an Existing Check</h2>
  379. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  380. <p>Updates an existing check. All request parameters are optional. The check is
  381. updated only with the supplied request parameters. If any parameter is omitted,
  382. its value is left unchanged.</p>
  383. <h3>Request Parameters</h3>
  384. <dl>
  385. <dt>name</dt>
  386. <dd>
  387. <p>string, optional.</p>
  388. <p>Name for the check.</p>
  389. </dd>
  390. <dt>tags</dt>
  391. <dd>
  392. <p>string, optional.</p>
  393. <p>A space-delimited list of tags for the check.</p>
  394. <p>Example:</p>
  395. <p><pre>{"tags": "reports staging"}</pre></p>
  396. </dd>
  397. <dt>desc</dt>
  398. <dd>
  399. <p>string, optional.</p>
  400. <p>Description for the check.</p>
  401. </dd>
  402. <dt>timeout</dt>
  403. <dd>
  404. <p>number, optional.</p>
  405. <p>A number of seconds, the expected period of this check.</p>
  406. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  407. <p>Example for 5 minute timeout:</p>
  408. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  409. </dd>
  410. <dt>grace</dt>
  411. <dd>
  412. <p>number, optional.</p>
  413. <p>A number of seconds, the grace period for this check.</p>
  414. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  415. </dd>
  416. <dt>schedule</dt>
  417. <dd>
  418. <p>string, optional.</p>
  419. <p>A cron expression defining this check's schedule.</p>
  420. <p>If you specify both "timeout" and "schedule" parameters, "timeout" will be
  421. ignored and "schedule" will be used.</p>
  422. <p>Example for a check running every half-hour:</p>
  423. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  424. </dd>
  425. <dt>tz</dt>
  426. <dd>
  427. <p>string, optional.</p>
  428. <p>Server's timezone. This setting only has effect in combination with the
  429. "schedule" parameter.</p>
  430. <p>Example:</p>
  431. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  432. </dd>
  433. <dt>manual_resume</dt>
  434. <dd>
  435. <p>boolean, optional, default value: false.</p>
  436. <p>Controls whether a paused ping resumes automatically when pinged (the default),
  437. or not. If set to false, a paused check will leave the paused state when it receives
  438. a ping. If set to true, a paused check will ignore pings and stay paused until it is
  439. either manually resumed from the web dashboard or the <code>manual_resume</code> flag is
  440. changed.</p>
  441. </dd>
  442. <dt>channels</dt>
  443. <dd>
  444. <p>string, optional.</p>
  445. <p>Set this field to a special value "*" to automatically assign all existing
  446. notification channels.</p>
  447. <p>Set this field to a special value "" (empty string) to automatically <em>unassign</em>
  448. all notification channels.</p>
  449. <p>Set this field to a comma-separated list of channel identifiers to assign
  450. specific notification channels.</p>
  451. <p>Example:</p>
  452. <p><pre>{"channels": "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  453. </dd>
  454. </dl>
  455. <h3>Response Codes</h3>
  456. <dl>
  457. <dt>200 OK</dt>
  458. <dd>The check was successfully updated.</dd>
  459. <dt>400 Bad Request</dt>
  460. <dd>The request is not well-formed, violates schema, or uses invalid
  461. field values.</dd>
  462. <dt>401 Unauthorized</dt>
  463. <dd>The API key is either missing or invalid.</dd>
  464. <dt>403 Forbidden</dt>
  465. <dd>Access denied, wrong API key.</dd>
  466. <dt>404 Not Found</dt>
  467. <dd>The specified check does not exist.</dd>
  468. </dl>
  469. <h3>Example Request</h3>
  470. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  471. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  472. --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>
  473. </code></pre></div>
  474. <p>Or, alternatively:</p>
  475. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  476. --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>
  477. </code></pre></div>
  478. <h3>Example Response</h3>
  479. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  480. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  481. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  482. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  483. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  484. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  485. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  486. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  487. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  488. <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>
  489. <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>
  490. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  491. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  492. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  493. <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>
  494. <span class="p">}</span>
  495. </code></pre></div>
  496. <h2 class="rule" id="pause-check">Pause Monitoring of a Check</h2>
  497. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></p>
  498. <p>Disables monitoring for a check, without removing it. The check goes into a "paused"
  499. state. You can resume monitoring of the check by pinging it.</p>
  500. <p>This API call has no request parameters.</p>
  501. <h3>Response Codes</h3>
  502. <dl>
  503. <dt>200 OK</dt>
  504. <dd>The check was successfully paused.</dd>
  505. <dt>401 Unauthorized</dt>
  506. <dd>The API key is either missing or invalid.</dd>
  507. <dt>403 Forbidden</dt>
  508. <dd>Access denied, wrong API key.</dd>
  509. <dt>404 Not Found</dt>
  510. <dd>The specified check does not exist.</dd>
  511. </dl>
  512. <h3>Example Request</h3>
  513. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span>
  514. --request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span>
  515. </code></pre></div>
  516. <p>Note: the <code>--data ""</code> argument forces curl to send a <code>Content-Length</code> request header
  517. even though the request body is empty. For HTTP POST requests, the <code>Content-Length</code>
  518. header is sometimes required by some network proxies and web servers.</p>
  519. <h3>Example Response</h3>
  520. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  521. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  522. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  523. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  524. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  525. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  526. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  527. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  528. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  529. <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>
  530. <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>
  531. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;paused&quot;</span><span class="p">,</span>
  532. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  533. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  534. <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>
  535. <span class="p">}</span>
  536. </code></pre></div>
  537. <h2 class="rule" id="delete-check">Delete Check</h2>
  538. <p><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  539. <p>Permanently deletes the check from user's account. Returns JSON representation of the
  540. check that was just deleted.</p>
  541. <p>This API call has no request parameters.</p>
  542. <h3>Response Codes</h3>
  543. <dl>
  544. <dt>200 OK</dt>
  545. <dd>The check was successfully deleted.</dd>
  546. <dt>401 Unauthorized</dt>
  547. <dd>The API key is either missing or invalid.</dd>
  548. <dt>403 Forbidden</dt>
  549. <dd>Access denied, wrong API key.</dd>
  550. <dt>404 Not Found</dt>
  551. <dd>The specified check does not exist.</dd>
  552. </dl>
  553. <h3>Example Request</h3>
  554. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  555. --request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  556. </code></pre></div>
  557. <h3>Example Response</h3>
  558. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  559. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  560. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  561. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  562. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  563. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  564. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  565. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  566. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  567. <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>
  568. <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>
  569. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  570. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  571. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  572. <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>
  573. <span class="p">}</span>
  574. </code></pre></div>
  575. <h2 class="rule" id="list-pings">Get a list of check's logged pings</h2>
  576. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pings/</code></p>
  577. <p>Returns a list of pings this check has received.</p>
  578. <p>This endpoint returns pings in reverse order (most recent first), and the total
  579. number of returned pings depends on account's billing plan: 100 for free accounts,
  580. 1000 for paid accounts.</p>
  581. <h3>Response Codes</h3>
  582. <dl>
  583. <dt>200 OK</dt>
  584. <dd>The request succeeded.</dd>
  585. <dt>401 Unauthorized</dt>
  586. <dd>The API key is either missing or invalid.</dd>
  587. <dt>403 Forbidden</dt>
  588. <dd>Access denied, wrong API key.</dd>
  589. <dt>404 Not Found</dt>
  590. <dd>The specified check does not exist.</dd>
  591. </dl>
  592. <h3>Example Request</h3>
  593. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pings/ <span class="se">\</span>
  594. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  595. </code></pre></div>
  596. <h3>Example Response</h3>
  597. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  598. <span class="nt">&quot;pings&quot;</span><span class="p">:</span> <span class="p">[</span>
  599. <span class="p">{</span>
  600. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;success&quot;</span><span class="p">,</span>
  601. <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>
  602. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
  603. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  604. <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>
  605. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  606. <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>
  607. <span class="nt">&quot;duration&quot;</span><span class="p">:</span> <span class="mf">2.896736</span>
  608. <span class="p">},</span>
  609. <span class="p">{</span>
  610. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span>
  611. <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>
  612. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
  613. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  614. <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>
  615. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  616. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span>
  617. <span class="p">},</span>
  618. <span class="p">{</span>
  619. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;success&quot;</span><span class="p">,</span>
  620. <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>
  621. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
  622. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  623. <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>
  624. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  625. <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>
  626. <span class="nt">&quot;duration&quot;</span><span class="p">:</span> <span class="mf">2.997976</span>
  627. <span class="p">},</span>
  628. <span class="p">{</span>
  629. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span>
  630. <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>
  631. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  632. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  633. <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>
  634. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  635. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span>
  636. <span class="p">}</span>
  637. <span class="p">]</span>
  638. <span class="p">}</span>
  639. </code></pre></div>
  640. <h2 class="rule" id="list-flips">Get a list of check's status changes</h2>
  641. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code><br>
  642. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;/flips/</code></p>
  643. <p>Returns a list of "flips" this check has experienced. A flip is a change of status
  644. (from "down" to "up", or from "up" to "down").</p>
  645. <h3>Query String Parameters</h3>
  646. <dl>
  647. <dt>seconds=&lt;value&gt;</dt>
  648. <dd>
  649. <p>Returns the flips from the last <code>value</code> seconds</p>
  650. <p>Example:</p>
  651. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?seconds=3600</code></p>
  652. </dd>
  653. <dt>start=&lt;value&gt;</dt>
  654. <dd>
  655. <p>Returns flips that are newer than the specified UNIX timestamp.</p>
  656. <p>Example:</p>
  657. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?start=1592214380</code></p>
  658. </dd>
  659. <dt>end=&lt;value&gt;</dt>
  660. <dd>
  661. <p>Returns flips that are older than the specified UNIX timestamp.</p>
  662. <p>Example:</p>
  663. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?end=1592217980</code></p>
  664. </dd>
  665. </dl>
  666. <h3>Response Codes</h3>
  667. <dl>
  668. <dt>200 OK</dt>
  669. <dd>The request succeeded.</dd>
  670. <dt>400 Bad Request</dt>
  671. <dd>Invalid query parameters.</dd>
  672. <dt>401 Unauthorized</dt>
  673. <dd>The API key is either missing or invalid.</dd>
  674. <dt>403 Forbidden</dt>
  675. <dd>Access denied, wrong API key.</dd>
  676. <dt>404 Not Found</dt>
  677. <dd>The specified check does not exist.</dd>
  678. </dl>
  679. <h3>Example Request</h3>
  680. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/flips/ <span class="se">\</span>
  681. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  682. </code></pre></div>
  683. <h3>Example Response</h3>
  684. <div class="json highlight"><pre><span></span><code><span class="p">[</span>
  685. <span class="p">{</span>
  686. <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>
  687. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  688. <span class="p">},</span>
  689. <span class="p">{</span>
  690. <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>
  691. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">0</span>
  692. <span class="p">},</span>
  693. <span class="p">{</span>
  694. <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>
  695. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  696. <span class="p">}</span>
  697. <span class="p">]</span>
  698. </code></pre></div>
  699. <h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2>
  700. <p><code>GET SITE_ROOT/api/v1/channels/</code></p>
  701. <p>Returns a list of integrations belonging to the project.</p>
  702. <h3>Response Codes</h3>
  703. <dl>
  704. <dt>200 OK</dt>
  705. <dd>The request succeeded.</dd>
  706. <dt>401 Unauthorized</dt>
  707. <dd>The API key is either missing or invalid.</dd>
  708. </dl>
  709. <h3>Example Request</h3>
  710. <div class="bash highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/channels/
  711. </code></pre></div>
  712. <h3>Example Response</h3>
  713. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  714. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="p">[</span>
  715. <span class="p">{</span>
  716. <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>
  717. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Work Email&quot;</span><span class="p">,</span>
  718. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;email&quot;</span>
  719. <span class="p">},</span>
  720. <span class="p">{</span>
  721. <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>
  722. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Phone&quot;</span><span class="p">,</span>
  723. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;sms&quot;</span>
  724. <span class="p">}</span>
  725. <span class="p">]</span>
  726. <span class="p">}</span>
  727. </code></pre></div>