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.

826 lines
50 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>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. </tbody>
  50. </table>
  51. <h2>Authentication</h2>
  52. <p>Your requests to SITE_NAME Management API must authenticate using an
  53. API key. All 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 an HTTP request. Alternatively, for POST requests with a JSON request body,
  73. the client can put 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 the 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 a 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;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  122. <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>
  123. <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>
  124. <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>
  125. <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>
  126. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  127. <span class="p">},</span>
  128. <span class="p">{</span>
  129. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  130. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  131. <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>
  132. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  133. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  134. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  135. <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>
  136. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  137. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  138. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  139. <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>
  140. <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>
  141. <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>
  142. <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>
  143. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  144. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  145. <span class="p">}</span>
  146. <span class="p">]</span>
  147. <span class="p">}</span>
  148. </code></pre></div>
  149. <p>When using the read-only API key, SITE_NAME omits the following fields from responses:
  150. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. It adds an extra
  151. <code>unique_key</code> field. The <code>unique_key</code> identifier is stable across API calls, and
  152. you can use it in the <a href="#get-check">Get a single check</a>
  153. and <a href="#list-flips">Get a list of check's status changes</a> API calls.</p>
  154. <p>Example:</p>
  155. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  156. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  157. <span class="p">{</span>
  158. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Filesystem Backup&quot;</span><span class="p">,</span>
  159. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;backup fs&quot;</span><span class="p">,</span>
  160. <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>
  161. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">600</span><span class="p">,</span>
  162. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  163. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  164. <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>
  165. <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>
  166. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  167. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  168. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;a6c7b0a8a66bed0df66abfdab3c77736861703ee&quot;</span><span class="p">,</span>
  169. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span>
  170. <span class="p">},</span>
  171. <span class="p">{</span>
  172. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  173. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  174. <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>
  175. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  176. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  177. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  178. <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>
  179. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  180. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  181. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  182. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  183. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  184. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  185. <span class="p">}</span>
  186. <span class="p">]</span>
  187. <span class="p">}</span>
  188. </code></pre></div>
  189. <h2 class="rule" id="get-check">Get a Single Check</h2>
  190. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code><br>
  191. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;</code></p>
  192. <p>Returns a JSON representation of a single check. Accepts either check's UUID or
  193. the <code>unique_key</code> (a field derived from UUID, and returned by API responses when
  194. using the read-only API key) as an identifier.</p>
  195. <h3>Response Codes</h3>
  196. <dl>
  197. <dt>200 OK</dt>
  198. <dd>The request succeeded.</dd>
  199. <dt>401 Unauthorized</dt>
  200. <dd>The API key is either missing or invalid.</dd>
  201. <dt>403 Forbidden</dt>
  202. <dd>Access denied, wrong API key.</dd>
  203. <dt>404 Not Found</dt>
  204. <dd>The specified check does not exist.</dd>
  205. </dl>
  206. <h3>Example Request</h3>
  207. <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;
  208. </code></pre></div>
  209. <h3>Example Response</h3>
  210. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  211. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  212. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  213. <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>
  214. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  215. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  216. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  217. <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>
  218. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  219. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  220. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  221. <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>
  222. <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>
  223. <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>
  224. <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>
  225. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  226. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  227. <span class="p">}</span>
  228. </code></pre></div>
  229. <h3>Example Read-Only Response</h3>
  230. <p>When using the read-only API key, SITE_NAME omits the following fields from responses:
  231. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. It adds an extra
  232. <code>unique_key</code> field. This identifier is stable across API calls.</p>
  233. <p>Note: although API omits the <code>ping_url</code>, <code>update_url</code>, and <code>pause_url</code> in read-only
  234. API responses, the client can easily construct these URLs themselves <em>if</em> they know the
  235. check's unique UUID.</p>
  236. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  237. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Database Backup&quot;</span><span class="p">,</span>
  238. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;production db&quot;</span><span class="p">,</span>
  239. <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>
  240. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">1200</span><span class="p">,</span>
  241. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
  242. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;down&quot;</span><span class="p">,</span>
  243. <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>
  244. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  245. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  246. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  247. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;124f983e0e3dcaeba921cfcef46efd084576e783&quot;</span><span class="p">,</span>
  248. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;15 5 * * *&quot;</span><span class="p">,</span>
  249. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span>
  250. <span class="p">}</span>
  251. </code></pre></div>
  252. <h2 class="rule" id="create-check">Create a Check</h2>
  253. <p><code>POST SITE_ROOT/api/v1/checks/</code></p>
  254. <p>Creates a new check and returns its ping URL.
  255. All request parameters are optional and will use their default
  256. values if omitted.</p>
  257. <p>With this API call, you can create both Simple and Cron checks:</p>
  258. <ul>
  259. <li>To create a Simple check, specify the <code>timeout</code> parameter.</li>
  260. <li>To create a Cron check, specify the <code>schedule</code> and <code>tz</code> parameters.</li>
  261. </ul>
  262. <h3>Request Parameters</h3>
  263. <dl>
  264. <dt>name</dt>
  265. <dd>
  266. <p>string, optional, default value: ""</p>
  267. <p>Name for the new check.</p>
  268. </dd>
  269. <dt>tags</dt>
  270. <dd>
  271. <p>string, optional, default value: ""</p>
  272. <p>A space-delimited list of tags for the new check.
  273. Example:</p>
  274. <p><pre>{"tags": "reports staging"}</pre></p>
  275. </dd>
  276. <dt>desc</dt>
  277. <dd>
  278. <p>string, optional.</p>
  279. <p>Description of the check.</p>
  280. </dd>
  281. <dt>timeout</dt>
  282. <dd>
  283. <p>number, optional, default value: {{ default_timeout }}.</p>
  284. <p>A number of seconds, the expected period of this check.</p>
  285. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  286. <p>Example for 5 minute timeout:</p>
  287. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  288. </dd>
  289. <dt>grace</dt>
  290. <dd>
  291. <p>number, optional, default value: {{ default_grace }}.</p>
  292. <p>A number of seconds, the grace period for this check.</p>
  293. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  294. </dd>
  295. <dt>schedule</dt>
  296. <dd>
  297. <p>string, optional, default value: "<code>* * * * *</code>".</p>
  298. <p>A cron expression defining this check's schedule.</p>
  299. <p>If you specify both <code>timeout</code> and <code>schedule</code> parameters,
  300. SITE_NAME will create a Cron check and ignore
  301. the <code>timeout</code> value.</p>
  302. <p>Example for a check running every half-hour:</p>
  303. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  304. </dd>
  305. <dt>tz</dt>
  306. <dd>
  307. <p>string, optional, default value: "UTC".</p>
  308. <p>Server's timezone. This setting only has an effect in combination with the
  309. <code>schedule</code> parameter.</p>
  310. <p>Example:</p>
  311. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  312. </dd>
  313. <dt>manual_resume</dt>
  314. <dd>
  315. <p>boolean, optional, default value: false.</p>
  316. <p>Controls whether a paused check automatically resumes when pinged (the default)
  317. or not. If set to false, a paused check will leave the paused state when it receives
  318. a ping. If set to true, a paused check will ignore pings and stay paused until
  319. you manually resume it from the web dashboard.</p>
  320. </dd>
  321. <dt>methods</dt>
  322. <dd>
  323. <p>string, optional, default value: "".</p>
  324. <p>Specifies the allowed HTTP methods for making ping requests.
  325. Must be one of the two values: "" (an empty string) or "POST".</p>
  326. <p>Set this field to "" (an empty string) to allow HEAD, GET,
  327. and POST requests.</p>
  328. <p>Set this field to "POST" to allow only POST requests.</p>
  329. <p>Example:</p>
  330. <p><pre>{"methods": "POST"}</pre></p>
  331. </dd>
  332. <dt>channels</dt>
  333. <dd>
  334. <p>string, optional</p>
  335. <p>By default, this API call assigns no integrations to the newly created
  336. check.</p>
  337. <p>Set this field to a special value "*" to automatically assign all existing
  338. integrations. Example:</p>
  339. <p><pre>{"channels": "*"}</pre></p>
  340. <p>To assign specific integrations, use a comma-separated list of integration
  341. UUIDs. You can look up integration UUIDs using the
  342. <a href="#list-channels">Get a List of Existing Integrations</a> API call.</p>
  343. <p>Example:</p>
  344. <p><pre>{"channels":
  345. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  346. <p>Alternatively, if you have named your integrations in SITE_NAME dashboard,
  347. you can specify integrations by their names. For this to work, your integrations
  348. need non-empty and unique names, and they must not contain commas. The names
  349. must match exactly, whitespace is significant.</p>
  350. <p>Example:</p>
  351. <p><pre>{"channels": "Email to Alice,SMS to Alice"}</pre></p>
  352. </dd>
  353. <dt>unique</dt>
  354. <dd>
  355. <p>array of string values, optional, default value: [].</p>
  356. <p>Enables "upsert" functionality. Before creating a check, SITE_NAME looks for
  357. existing checks, filtered by fields listed in <code>unique</code>.</p>
  358. <p>If SITE_NAME does not find a matching check, it creates a new check and returns it
  359. with the HTTP status code 201.</p>
  360. <p>If SITE_NAME finds a matching check, it updates the existing check and
  361. and returns it with HTTP status code 200.</p>
  362. <p>The accepted values for the <code>unique</code> field are
  363. <code>name</code>, <code>tags</code>, <code>timeout</code> and <code>grace</code>.</p>
  364. <p>Example:</p>
  365. <p><pre>{"name": "Backups", unique: ["name"]}</pre></p>
  366. <p>In this example, if a check named "Backups" exists, it will be returned.
  367. Otherwise, a new check will be created and returned.</p>
  368. </dd>
  369. </dl>
  370. <h3>Response Codes</h3>
  371. <dl>
  372. <dt>201 Created</dt>
  373. <dd>A new check was successfully created.</dd>
  374. <dt>200 OK</dt>
  375. <dd>An existing check was found and updated.</dd>
  376. <dt>400 Bad Request</dt>
  377. <dd>The request is not well-formed, violates schema, or uses invalid
  378. field values.</dd>
  379. <dt>401 Unauthorized</dt>
  380. <dd>The API key is either missing or invalid.</dd>
  381. <dt>403 Forbidden</dt>
  382. <dd>The account has hit its check limit. For free accounts,
  383. the limit is 20 checks per account.</dd>
  384. </dl>
  385. <h3>Example Request</h3>
  386. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  387. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  388. --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>
  389. </code></pre></div>
  390. <p>Or, alternatively:</p>
  391. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  392. --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>
  393. </code></pre></div>
  394. <h3>Example Response</h3>
  395. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  396. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  397. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  398. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  399. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  400. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  401. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  402. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  403. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  404. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  405. <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>
  406. <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>
  407. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  408. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  409. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  410. <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>
  411. <span class="p">}</span>
  412. </code></pre></div>
  413. <h2 class="rule" id="update-check">Update an Existing Check</h2>
  414. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  415. <p>Updates an existing check. All request parameters are optional. If you omit any
  416. parameter, SITE_NAME will leave its value unchanged.</p>
  417. <h3>Request Parameters</h3>
  418. <dl>
  419. <dt>name</dt>
  420. <dd>
  421. <p>string, optional.</p>
  422. <p>Name for the check.</p>
  423. </dd>
  424. <dt>tags</dt>
  425. <dd>
  426. <p>string, optional.</p>
  427. <p>A space-delimited list of tags for the check.</p>
  428. <p>Example:</p>
  429. <p><pre>{"tags": "reports staging"}</pre></p>
  430. </dd>
  431. <dt>desc</dt>
  432. <dd>
  433. <p>string, optional.</p>
  434. <p>Description of the check.</p>
  435. </dd>
  436. <dt>timeout</dt>
  437. <dd>
  438. <p>number, optional.</p>
  439. <p>A number of seconds, the expected period of this check.</p>
  440. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  441. <p>Example for 5 minute timeout:</p>
  442. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  443. </dd>
  444. <dt>grace</dt>
  445. <dd>
  446. <p>number, optional.</p>
  447. <p>A number of seconds, the grace period for this check.</p>
  448. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  449. </dd>
  450. <dt>schedule</dt>
  451. <dd>
  452. <p>string, optional.</p>
  453. <p>A cron expression defining this check's schedule.</p>
  454. <p>If you specify both <code>timeout</code> and <code>schedule</code> parameters,
  455. SITE_NAME will save the <code>schedule</code> parameter and ignore
  456. the <code>timeout</code>.</p>
  457. <p>Example for a check running every half-hour:</p>
  458. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  459. </dd>
  460. <dt>tz</dt>
  461. <dd>
  462. <p>string, optional.</p>
  463. <p>Server's timezone. This setting only has an effect in combination with the
  464. "schedule" parameter.</p>
  465. <p>Example:</p>
  466. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  467. </dd>
  468. <dt>manual_resume</dt>
  469. <dd>
  470. <p>boolean, optional, default value: false.</p>
  471. <p>Controls whether a paused ping automatically resumes when pinged (the default),
  472. or not. If set to false, a paused check will leave the paused state when it receives
  473. a ping. If set to true, a paused check will ignore pings and stay paused until
  474. you manually resume it from the web dashboard.</p>
  475. </dd>
  476. <dt>methods</dt>
  477. <dd>
  478. <p>string, optional, default value: "".</p>
  479. <p>Specifies the allowed HTTP methods for making ping requests.
  480. Must be one of the two values: "" (an empty string) or "POST".</p>
  481. <p>Set this field to "" (an empty string) to allow HEAD, GET,
  482. and POST requests.</p>
  483. <p>Set this field to "POST" to allow only POST requests.</p>
  484. <p>Example:</p>
  485. <p><pre>{"methods": "POST"}</pre></p>
  486. </dd>
  487. <dt>channels</dt>
  488. <dd>
  489. <p>string, optional.</p>
  490. <p>Set this field to a special value "*" to automatically assign all existing
  491. integrations. Example:</p>
  492. <p><pre>{"channels": "*"}</pre></p>
  493. <p>Set this field to a special value "" (empty string) to automatically <em>unassign</em>
  494. all existing integrations. Example:</p>
  495. <p><pre>{"channels": ""}</pre></p>
  496. <p>To assign specific integrations, use a comma-separated list of integration
  497. UUIDs. You can look up integration UUIDs using the
  498. <a href="#list-channels">Get a List of Existing Integrations</a> API call.</p>
  499. <p>Example:</p>
  500. <p><pre>{"channels":
  501. "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  502. <p>Alternatively, if you have named your integrations in SITE_NAME dashboard,
  503. you can specify integrations by their names. For this to work, your integrations
  504. need non-empty and unique names, and they must not contain commas. The names
  505. must match exactly, whitespace is significant.</p>
  506. <p>Example:</p>
  507. <p><pre>{"channels": "Email to Alice,SMS to Alice"}</pre></p>
  508. </dd>
  509. </dl>
  510. <h3>Response Codes</h3>
  511. <dl>
  512. <dt>200 OK</dt>
  513. <dd>The check was successfully updated.</dd>
  514. <dt>400 Bad Request</dt>
  515. <dd>The request is not well-formed, violates schema, or uses invalid
  516. field values.</dd>
  517. <dt>401 Unauthorized</dt>
  518. <dd>The API key is either missing or invalid.</dd>
  519. <dt>403 Forbidden</dt>
  520. <dd>Access denied, wrong API key.</dd>
  521. <dt>404 Not Found</dt>
  522. <dd>The specified check does not exist.</dd>
  523. </dl>
  524. <h3>Example Request</h3>
  525. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  526. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  527. --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>
  528. </code></pre></div>
  529. <p>Or, alternatively:</p>
  530. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  531. --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>
  532. </code></pre></div>
  533. <h3>Example Response</h3>
  534. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  535. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  536. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  537. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  538. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  539. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  540. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  541. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  542. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  543. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  544. <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>
  545. <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>
  546. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  547. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  548. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  549. <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>
  550. <span class="p">}</span>
  551. </code></pre></div>
  552. <h2 class="rule" id="pause-check">Pause Monitoring of a Check</h2>
  553. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></p>
  554. <p>Disables monitoring for a check, without removing it. The check goes into a "paused"
  555. state. You can resume monitoring of the check by pinging it.</p>
  556. <p>This API call has no request parameters.</p>
  557. <h3>Response Codes</h3>
  558. <dl>
  559. <dt>200 OK</dt>
  560. <dd>The check was successfully paused.</dd>
  561. <dt>401 Unauthorized</dt>
  562. <dd>The API key is either missing or invalid.</dd>
  563. <dt>403 Forbidden</dt>
  564. <dd>Access denied, wrong API key.</dd>
  565. <dt>404 Not Found</dt>
  566. <dd>The specified check does not exist.</dd>
  567. </dl>
  568. <h3>Example Request</h3>
  569. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span>
  570. --request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span>
  571. </code></pre></div>
  572. <p>Note: the <code>--data ""</code> argument forces curl to send a <code>Content-Length</code> request header
  573. even though the request body is empty. For HTTP POST requests, the <code>Content-Length</code>
  574. header is sometimes required by some network proxies and web servers.</p>
  575. <h3>Example Response</h3>
  576. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  577. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  578. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  579. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  580. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  581. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  582. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  583. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  584. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  585. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  586. <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>
  587. <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>
  588. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;paused&quot;</span><span class="p">,</span>
  589. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  590. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  591. <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>
  592. <span class="p">}</span>
  593. </code></pre></div>
  594. <h2 class="rule" id="delete-check">Delete Check</h2>
  595. <p><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  596. <p>Permanently deletes the check from user's account. Returns JSON representation of the
  597. check that was just deleted.</p>
  598. <p>This API call has no request parameters.</p>
  599. <h3>Response Codes</h3>
  600. <dl>
  601. <dt>200 OK</dt>
  602. <dd>The check was successfully deleted.</dd>
  603. <dt>401 Unauthorized</dt>
  604. <dd>The API key is either missing or invalid.</dd>
  605. <dt>403 Forbidden</dt>
  606. <dd>Access denied, wrong API key.</dd>
  607. <dt>404 Not Found</dt>
  608. <dd>The specified check does not exist.</dd>
  609. </dl>
  610. <h3>Example Request</h3>
  611. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  612. --request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  613. </code></pre></div>
  614. <h3>Example Response</h3>
  615. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  616. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  617. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  618. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  619. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  620. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  621. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  622. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  623. <span class="nt">&quot;manual_resume&quot;</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  624. <span class="nt">&quot;methods&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  625. <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>
  626. <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>
  627. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  628. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  629. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  630. <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>
  631. <span class="p">}</span>
  632. </code></pre></div>
  633. <h2 class="rule" id="list-pings">Get a list of check's logged pings</h2>
  634. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pings/</code></p>
  635. <p>Returns a list of pings this check has received.</p>
  636. <p>This endpoint returns pings in reverse order (most recent first), and the total
  637. number of returned pings depends on account's billing plan: 100 for free accounts,
  638. 1000 for paid accounts.</p>
  639. <h3>Response Codes</h3>
  640. <dl>
  641. <dt>200 OK</dt>
  642. <dd>The request succeeded.</dd>
  643. <dt>401 Unauthorized</dt>
  644. <dd>The API key is either missing or invalid.</dd>
  645. <dt>403 Forbidden</dt>
  646. <dd>Access denied, wrong API key.</dd>
  647. <dt>404 Not Found</dt>
  648. <dd>The specified check does not exist.</dd>
  649. </dl>
  650. <h3>Example Request</h3>
  651. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/pings/ <span class="se">\</span>
  652. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  653. </code></pre></div>
  654. <h3>Example Response</h3>
  655. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  656. <span class="nt">&quot;pings&quot;</span><span class="p">:</span> <span class="p">[</span>
  657. <span class="p">{</span>
  658. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;success&quot;</span><span class="p">,</span>
  659. <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>
  660. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
  661. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  662. <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>
  663. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  664. <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>
  665. <span class="nt">&quot;duration&quot;</span><span class="p">:</span> <span class="mf">2.896736</span>
  666. <span class="p">},</span>
  667. <span class="p">{</span>
  668. <span class="nt">&quot;type&quot;</span><span class="p">:</span> <span class="s2">&quot;start&quot;</span><span class="p">,</span>
  669. <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>
  670. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
  671. <span class="nt">&quot;scheme&quot;</span><span class="p">:</span> <span class="s2">&quot;http&quot;</span><span class="p">,</span>
  672. <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>
  673. <span class="nt">&quot;method&quot;</span><span class="p">:</span> <span class="s2">&quot;GET&quot;</span><span class="p">,</span>
  674. <span class="nt">&quot;ua&quot;</span><span class="p">:</span> <span class="s2">&quot;curl/7.68.0&quot;</span>
  675. <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:50:59.633577+00:00&quot;</span><span class="p">,</span>
  679. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">2</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.997976</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:50:56.635601+00:00&quot;</span><span class="p">,</span>
  689. <span class="nt">&quot;n&quot;</span><span class="p">:</span> <span class="mi">1</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="p">}</span>
  697. </code></pre></div>
  698. <h2 class="rule" id="list-flips">Get a list of check's status changes</h2>
  699. <p><code>GET SITE_ROOT/api/v1/checks/&lt;uuid&gt;/flips/</code><br>
  700. <code>GET SITE_ROOT/api/v1/checks/&lt;unique_key&gt;/flips/</code></p>
  701. <p>Returns a list of "flips" this check has experienced. A flip is a change of status
  702. (from "down" to "up", or from "up" to "down").</p>
  703. <h3>Query String Parameters</h3>
  704. <dl>
  705. <dt>seconds=&lt;value&gt;</dt>
  706. <dd>
  707. <p>Returns the flips from the last <code>value</code> seconds</p>
  708. <p>Example:</p>
  709. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?seconds=3600</code></p>
  710. </dd>
  711. <dt>start=&lt;value&gt;</dt>
  712. <dd>
  713. <p>Returns flips that are newer than the specified UNIX timestamp.</p>
  714. <p>Example:</p>
  715. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?start=1592214380</code></p>
  716. </dd>
  717. <dt>end=&lt;value&gt;</dt>
  718. <dd>
  719. <p>Returns flips that are older than the specified UNIX timestamp.</p>
  720. <p>Example:</p>
  721. <p><code>SITE_ROOT/api/v1/checks/&lt;uuid|unique_key&gt;/flips/?end=1592217980</code></p>
  722. </dd>
  723. </dl>
  724. <h3>Response Codes</h3>
  725. <dl>
  726. <dt>200 OK</dt>
  727. <dd>The request succeeded.</dd>
  728. <dt>400 Bad Request</dt>
  729. <dd>Invalid query parameters.</dd>
  730. <dt>401 Unauthorized</dt>
  731. <dd>The API key is either missing or invalid.</dd>
  732. <dt>403 Forbidden</dt>
  733. <dd>Access denied, wrong API key.</dd>
  734. <dt>404 Not Found</dt>
  735. <dd>The specified check does not exist.</dd>
  736. </dl>
  737. <h3>Example Request</h3>
  738. <div class="bash highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc/flips/ <span class="se">\</span>
  739. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  740. </code></pre></div>
  741. <h3>Example Response</h3>
  742. <div class="json highlight"><pre><span></span><code><span class="p">[</span>
  743. <span class="p">{</span>
  744. <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>
  745. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  746. <span class="p">},</span>
  747. <span class="p">{</span>
  748. <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>
  749. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">0</span>
  750. <span class="p">},</span>
  751. <span class="p">{</span>
  752. <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>
  753. <span class="nt">&quot;up&quot;</span><span class="p">:</span> <span class="mi">1</span>
  754. <span class="p">}</span>
  755. <span class="p">]</span>
  756. </code></pre></div>
  757. <h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2>
  758. <p><code>GET SITE_ROOT/api/v1/channels/</code></p>
  759. <p>Returns a list of integrations belonging to the project.</p>
  760. <h3>Response Codes</h3>
  761. <dl>
  762. <dt>200 OK</dt>
  763. <dd>The request succeeded.</dd>
  764. <dt>401 Unauthorized</dt>
  765. <dd>The API key is either missing or invalid.</dd>
  766. </dl>
  767. <h3>Example Request</h3>
  768. <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/
  769. </code></pre></div>
  770. <h3>Example Response</h3>
  771. <div class="json highlight"><pre><span></span><code><span class="p">{</span>
  772. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="p">[</span>
  773. <span class="p">{</span>
  774. <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>
  775. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Work Email&quot;</span><span class="p">,</span>
  776. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;email&quot;</span>
  777. <span class="p">},</span>
  778. <span class="p">{</span>
  779. <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>
  780. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Phone&quot;</span><span class="p">,</span>
  781. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;sms&quot;</span>
  782. <span class="p">}</span>
  783. <span class="p">]</span>
  784. <span class="p">}</span>
  785. </code></pre></div>