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.

536 lines
30 KiB

  1. <h1>API Reference</h1>
  2. <p>SITE_NAME REST 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="#create-check">Create a new check</a></td>
  19. <td><code>POST SITE_ROOT/api/v1/checks/</code></td>
  20. </tr>
  21. <tr>
  22. <td><a href="#update-check">Update an existing check</a></td>
  23. <td><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></td>
  24. </tr>
  25. <tr>
  26. <td><a href="#pause-check">Pause monitoring of a check</a></td>
  27. <td><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></td>
  28. </tr>
  29. <tr>
  30. <td><a href="#delete-check">Delete check</a></td>
  31. <td><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></td>
  32. </tr>
  33. <tr>
  34. <td><a href="#list-channels">Get a list of existing integrations</a></td>
  35. <td><code>GET SITE_ROOT/api/v1/channels/</code></td>
  36. </tr>
  37. </tbody>
  38. </table>
  39. <h2>Authentication</h2>
  40. <p>Your requests to SITE_NAME REST API must authenticate using an
  41. API key. Each project in your SITE_NAME account has separate API keys.
  42. There are no account-wide API keys. By default, a project on SITE_NAME doesn't have
  43. an API key. You can create read-write and read-only API keys in the
  44. <strong>Project Settings</strong> page.</p>
  45. <table>
  46. <thead>
  47. <tr>
  48. <th>Key Type</th>
  49. <th>Description</th>
  50. </tr>
  51. </thead>
  52. <tbody>
  53. <tr>
  54. <td>Regular API key</td>
  55. <td>Have full access to all documented API endpoints.</td>
  56. </tr>
  57. <tr>
  58. <td>Read-only API key</td>
  59. <td>Only work with the <a href="#list-checks">Get a list of existing checks</a> endpoint. Some fields are omitted from the API responses.</td>
  60. </tr>
  61. </tbody>
  62. </table>
  63. <p>The client can authenticate itself by sending an appropriate HTTP
  64. request header. The header's name should be <code>X-Api-Key</code> and
  65. its value should be your API key.</p>
  66. <p>Alternatively, for POST requests with a JSON request body,
  67. the client can include an <code>api_key</code> field in the JSON document.
  68. See below the "Create a check" section for an example.</p>
  69. <h2>API Requests</h2>
  70. <p>For POST requests, the SITE_NAME API expects request body to be
  71. a JSON document (<em>not</em> a <code>multipart/form-data</code> encoded form data).</p>
  72. <h2>API Responses</h2>
  73. <p>SITE_NAME uses HTTP status codes wherever possible.
  74. In general, 2xx class indicates success, 4xx indicates an client error,
  75. and 5xx indicates a server error.</p>
  76. <p>The response may contain a JSON document with additional data.</p>
  77. <h2 class="rule" id="list-checks">Get a List of Existing Checks</h2>
  78. <p><code>GET SITE_ROOT/api/v1/checks/</code></p>
  79. <p>Returns a list of checks belonging to the user, optionally filtered by
  80. one or more tags.</p>
  81. <h3>Query String Parameters</h3>
  82. <dl>
  83. <dt>tag=&lt;value&gt;</dt>
  84. <dd>
  85. <p>Filters the checks, and returns only the checks that are tagged with the
  86. specified value.</p>
  87. <p>This parameter can be repeated multiple times.</p>
  88. <p>Example:</p>
  89. <p><code>SITE_ROOT/api/v1/checks/?tag=foo&amp;tag=bar</code></p>
  90. </dd>
  91. </dl>
  92. <h3>Response Codes</h3>
  93. <dl>
  94. <dt>200 OK</dt>
  95. <dd>The request succeeded.</dd>
  96. <dt>401 Unauthorized</dt>
  97. <dd>The API key is either missing or invalid.</dd>
  98. </dl>
  99. <h3>Example Request</h3>
  100. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/checks/
  101. </code></pre></div>
  102. <h3>Example Response</h3>
  103. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  104. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  105. <span class="p">{</span>
  106. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc&quot;</span><span class="p">,</span>
  107. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Longer free-form description goes here&quot;</span><span class="p">,</span>
  108. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">900</span><span class="p">,</span>
  109. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2017-01-04T13:24:39.903464+00:00&quot;</span><span class="p">,</span>
  110. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  111. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Api test 1&quot;</span><span class="p">,</span>
  112. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2017-01-04T14:24:39.903464+00:00&quot;</span><span class="p">,</span>
  113. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/662ebe36-ecab-48db-afe3-e20029cb71e6/pause&quot;</span><span class="p">,</span>
  114. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINT662ebe36-ecab-48db-afe3-e20029cb71e6&quot;</span><span class="p">,</span>
  115. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  116. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;foo&quot;</span><span class="p">,</span>
  117. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  118. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/662ebe36-ecab-48db-afe3-e20029cb71e6&quot;</span>
  119. <span class="p">},</span>
  120. <span class="p">{</span>
  121. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  122. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  123. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  124. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  125. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  126. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Api test 2&quot;</span><span class="p">,</span>
  127. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  128. <span class="nt">&quot;pause_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/9d17c61f-5c4f-4cab-b517-11e6b2679ced/pause&quot;</span><span class="p">,</span>
  129. <span class="nt">&quot;ping_url&quot;</span><span class="p">:</span> <span class="s2">&quot;PING_ENDPOINT9d17c61f-5c4f-4cab-b517-11e6b2679ced&quot;</span><span class="p">,</span>
  130. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;0/10 * * * *&quot;</span><span class="p">,</span>
  131. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  132. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;bar baz&quot;</span><span class="p">,</span>
  133. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span><span class="p">,</span>
  134. <span class="nt">&quot;update_url&quot;</span><span class="p">:</span> <span class="s2">&quot;SITE_ROOT/api/v1/checks/9d17c61f-5c4f-4cab-b517-11e6b2679ced&quot;</span>
  135. <span class="p">}</span>
  136. <span class="p">]</span>
  137. <span class="p">}</span>
  138. </code></pre></div>
  139. <p>When using the read-only API key, the following fields are omitted:
  140. <code>ping_url</code>, <code>update_url</code>, <code>pause_url</code>, <code>channels</code>. An extra <code>unique_key</code> field
  141. is added. This identifier is stable across API calls. Example:</p>
  142. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  143. <span class="nt">&quot;checks&quot;</span><span class="p">:</span> <span class="p">[</span>
  144. <span class="p">{</span>
  145. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;Longer free-form description goes here&quot;</span><span class="p">,</span>
  146. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">900</span><span class="p">,</span>
  147. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="s2">&quot;2017-01-04T13:24:39.903464+00:00&quot;</span><span class="p">,</span>
  148. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
  149. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Api test 1&quot;</span><span class="p">,</span>
  150. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;up&quot;</span><span class="p">,</span>
  151. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;foo&quot;</span><span class="p">,</span>
  152. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  153. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;2872190d95224bad120f41d3c06aab94b8175bb6&quot;</span>
  154. <span class="p">},</span>
  155. <span class="p">{</span>
  156. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  157. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  158. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  159. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  160. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Api test 2&quot;</span><span class="p">,</span>
  161. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  162. <span class="nt">&quot;schedule&quot;</span><span class="p">:</span> <span class="s2">&quot;0/10 * * * *&quot;</span><span class="p">,</span>
  163. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  164. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;bar baz&quot;</span><span class="p">,</span>
  165. <span class="nt">&quot;tz&quot;</span><span class="p">:</span> <span class="s2">&quot;UTC&quot;</span><span class="p">,</span>
  166. <span class="nt">&quot;unique_key&quot;</span><span class="p">:</span> <span class="s2">&quot;9b5fc29129560ff2c5c1803803a7415e4f80cf7e&quot;</span>
  167. <span class="p">}</span>
  168. <span class="p">]</span>
  169. <span class="p">}</span>
  170. </code></pre></div>
  171. <h2 class="rule" id="create-check">Create a Check</h2>
  172. <p><code>POST SITE_ROOT/api/v1/checks/</code></p>
  173. <p>Creates a new check and returns its ping URL.
  174. All request parameters are optional and will use their default
  175. values if omitted.</p>
  176. <p>This API call can be used to create both "simple" and "cron" checks.
  177. To create a "simple" check, specify the "timeout" parameter.
  178. To create a "cron" check, specify the "schedule" and "tz" parameters.</p>
  179. <h3>Request Parameters</h3>
  180. <dl>
  181. <dt>name</dt>
  182. <dd>
  183. <p>string, optional, default value: ""</p>
  184. <p>Name for the new check.</p>
  185. </dd>
  186. <dt>tags</dt>
  187. <dd>
  188. <p>string, optional, default value: ""</p>
  189. <p>A space-delimited list of tags for the new check.
  190. Example:</p>
  191. <p><pre>{"tags": "reports staging"}</pre></p>
  192. </dd>
  193. <dt>desc</dt>
  194. <dd>
  195. <p>string, optional.</p>
  196. <p>Description for the check.</p>
  197. </dd>
  198. <dt>timeout</dt>
  199. <dd>
  200. <p>number, optional, default value: {{ default_timeout }}.</p>
  201. <p>A number of seconds, the expected period of this check.</p>
  202. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  203. <p>Example for 5 minute timeout:</p>
  204. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  205. </dd>
  206. <dt>grace</dt>
  207. <dd>
  208. <p>number, optional, default value: {{ default_grace }}.</p>
  209. <p>A number of seconds, the grace period for this check.</p>
  210. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  211. </dd>
  212. <dt>schedule</dt>
  213. <dd>
  214. <p>string, optional, default value: "<em> * </em> * *".</p>
  215. <p>A cron expression defining this check's schedule.</p>
  216. <p>If you specify both "timeout" and "schedule" parameters, "timeout" will be
  217. ignored and "schedule" will be used.</p>
  218. <p>Example for a check running every half-hour:</p>
  219. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  220. </dd>
  221. <dt>tz</dt>
  222. <dd>
  223. <p>string, optional, default value: "UTC".</p>
  224. <p>Server's timezone. This setting only has effect in combination with the
  225. "schedule" paremeter.</p>
  226. <p>Example:</p>
  227. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  228. </dd>
  229. <dt>channels</dt>
  230. <dd>
  231. <p>string, optional</p>
  232. <p>By default, if a check is created through API, no notification channels
  233. (integrations) are assigned to it. So, when the check goes up or down, no
  234. notifications will get sent.</p>
  235. <p>Set this field to a special value "*" to automatically assign all existing
  236. integrations.</p>
  237. <p>To assign specific integrations, use a comma-separated list of integration
  238. identifiers. Use the <a href="#list-channels">Get a List of Existing Integrations</a> call to
  239. look up integration identifiers.</p>
  240. </dd>
  241. <dt>unique</dt>
  242. <dd>
  243. <p>array of string values, optional, default value: [].</p>
  244. <p>Before creating a check, look for existing checks, filtered by fields listed
  245. in <code>unique</code>. If a matching check is found, return it with HTTP status code 200.
  246. If no matching check is found, proceed as normal: create a check and return it
  247. with HTTP status code 201.</p>
  248. <p>The accepted values are: <code>name</code>, <code>tags</code>, <code>timeout</code> and <code>grace</code>.</p>
  249. <p>Example:</p>
  250. <p><pre>{"name": "Backups", unique: ["name"]}</pre></p>
  251. <p>In this example, if a check named "Backups" exists, it will be returned.
  252. Otherwise, a new check will be created and returned.</p>
  253. </dd>
  254. </dl>
  255. <h3>Response Codes</h3>
  256. <dl>
  257. <dt>201 Created</dt>
  258. <dd>The check was successfully created.</dd>
  259. <dt>200 OK</dt>
  260. <dd>The <code>unique</code> parameter was used and an existing check was matched.</dd>
  261. <dt>400 Bad Request</dt>
  262. <dd>The request is not well-formed, violates schema, or uses invalid
  263. field values.</dd>
  264. <dt>401 Unauthorized</dt>
  265. <dd>The API key is either missing or invalid.</dd>
  266. <dt>403 Forbidden</dt>
  267. <dd>The account's check limit has been reached. For free accounts,
  268. the limit is 20 checks per account.</dd>
  269. </dl>
  270. <h3>Example Request</h3>
  271. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  272. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  273. --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>
  274. </code></pre></div>
  275. <p>Or, alternatively:</p>
  276. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/ <span class="se">\</span>
  277. --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>
  278. </code></pre></div>
  279. <h3>Example Response</h3>
  280. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  281. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  282. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  283. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  284. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  285. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  286. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  287. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  288. <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>
  289. <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>
  290. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  291. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  292. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  293. <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>
  294. <span class="p">}</span>
  295. </code></pre></div>
  296. <h2 class="rule" id="update-check">Update an Existing Check</h2>
  297. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  298. <p>Updates an existing check. All request parameters are optional. The check is
  299. updated only with the supplied request parameters. If any parameter is omitted,
  300. its value is left unchanged.</p>
  301. <h3>Request Parameters</h3>
  302. <dl>
  303. <dt>name</dt>
  304. <dd>
  305. <p>string, optional.</p>
  306. <p>Name for the check.</p>
  307. </dd>
  308. <dt>tags</dt>
  309. <dd>
  310. <p>string, optional.</p>
  311. <p>A space-delimited list of tags for the check.</p>
  312. <p>Example:</p>
  313. <p><pre>{"tags": "reports staging"}</pre></p>
  314. </dd>
  315. <dt>desc</dt>
  316. <dd>
  317. <p>string, optional.</p>
  318. <p>Description for the check.</p>
  319. </dd>
  320. <dt>timeout</dt>
  321. <dd>
  322. <p>number, optional.</p>
  323. <p>A number of seconds, the expected period of this check.</p>
  324. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  325. <p>Example for 5 minute timeout:</p>
  326. <p><pre>{"kind": "simple", "timeout": 300}</pre></p>
  327. </dd>
  328. <dt>grace</dt>
  329. <dd>
  330. <p>number, optional.</p>
  331. <p>A number of seconds, the grace period for this check.</p>
  332. <p>Minimum: 60 (one minute), maximum: 2592000 (30 days).</p>
  333. </dd>
  334. <dt>schedule</dt>
  335. <dd>
  336. <p>string, optional.</p>
  337. <p>A cron expression defining this check's schedule.</p>
  338. <p>If you specify both "timeout" and "schedule" parameters, "timeout" will be
  339. ignored and "schedule" will be used.</p>
  340. <p>Example for a check running every half-hour:</p>
  341. <p><pre>{"schedule": "0,30 * <em> * </em>"}</pre></p>
  342. </dd>
  343. <dt>tz</dt>
  344. <dd>
  345. <p>string, optional.</p>
  346. <p>Server's timezone. This setting only has effect in combination with the
  347. "schedule" paremeter.</p>
  348. <p>Example:</p>
  349. <p><pre>{"tz": "Europe/Riga"}</pre></p>
  350. </dd>
  351. <dt>channels</dt>
  352. <dd>
  353. <p>string, optional.</p>
  354. <p>Set this field to a special value "*" to automatically assign all existing
  355. notification channels.</p>
  356. <p>Set this field to a special value "" (empty string) to automatically <em>unassign</em>
  357. all notification channels.</p>
  358. <p>Set this field to a comma-separated list of channel identifiers to assign
  359. specific notification channels.</p>
  360. <p>Example:</p>
  361. <p><pre>{"channels": "4ec5a071-2d08-4baa-898a-eb4eb3cd6941,746a083e-f542-4554-be1a-707ce16d3acc"}</pre></p>
  362. </dd>
  363. </dl>
  364. <h3>Response Codes</h3>
  365. <dl>
  366. <dt>200 OK</dt>
  367. <dd>The check was successfully updated.</dd>
  368. <dt>400 Bad Request</dt>
  369. <dd>The request is not well-formed, violates schema, or uses invalid
  370. field values.</dd>
  371. <dt>401 Unauthorized</dt>
  372. <dd>The API key is either missing or invalid.</dd>
  373. <dt>403 Forbidden</dt>
  374. <dd>Access denied, wrong API key.</dd>
  375. <dt>404 Not Found</dt>
  376. <dd>The specified check does not exist.</dd>
  377. </dl>
  378. <h3>Example Request</h3>
  379. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  380. --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> <span class="se">\</span>
  381. --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>
  382. </code></pre></div>
  383. <p>Or, alternatively:</p>
  384. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  385. --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>
  386. </code></pre></div>
  387. <h3>Example Response</h3>
  388. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  389. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  390. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  391. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  392. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  393. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  394. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  395. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  396. <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>
  397. <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>
  398. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  399. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  400. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  401. <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>
  402. <span class="p">}</span>
  403. </code></pre></div>
  404. <h2 class="rule" id="pause-check">Pause Monitoring of a Check</h2>
  405. <p><code>POST SITE_ROOT/api/v1/checks/&lt;uuid&gt;/pause</code></p>
  406. <p>Disables monitoring for a check, without removing it. The check goes into a "paused"
  407. state. You can resume monitoring of the check by pinging it.</p>
  408. <p>This API call has no request parameters.</p>
  409. <h3>Response Codes</h3>
  410. <dl>
  411. <dt>200 OK</dt>
  412. <dd>The check was successfully paused.</dd>
  413. <dt>401 Unauthorized</dt>
  414. <dd>The API key is either missing or invalid.</dd>
  415. <dt>403 Forbidden</dt>
  416. <dd>Access denied, wrong API key.</dd>
  417. <dt>404 Not Found</dt>
  418. <dd>The specified check does not exist.</dd>
  419. </dl>
  420. <h3>Example Request</h3>
  421. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/0c8983c9-9d73-446f-adb5-0641fdacc9d4/pause <span class="se">\</span>
  422. --request POST --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> --data <span class="s2">&quot;&quot;</span>
  423. </code></pre></div>
  424. <p>Note: the <code>--data ""</code> argument forces curl to send a <code>Content-Length</code> request header
  425. even though the request body is empty. For HTTP POST requests, the <code>Content-Length</code>
  426. header is sometimes required by some network proxies and web servers.</p>
  427. <h3>Example Response</h3>
  428. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  429. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  430. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  431. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  432. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  433. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  434. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  435. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  436. <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>
  437. <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>
  438. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;paused&quot;</span><span class="p">,</span>
  439. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  440. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  441. <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>
  442. <span class="p">}</span>
  443. </code></pre></div>
  444. <h2 class="rule" id="delete-check">Delete Check</h2>
  445. <p><code>DELETE SITE_ROOT/api/v1/checks/&lt;uuid&gt;</code></p>
  446. <p>Permanently deletes the check from user's account. Returns JSON representation of the
  447. check that was just deleted.</p>
  448. <p>This API call has no request parameters.</p>
  449. <h3>Response Codes</h3>
  450. <dl>
  451. <dt>200 OK</dt>
  452. <dd>The check was successfully deleted.</dd>
  453. <dt>401 Unauthorized</dt>
  454. <dd>The API key is either missing or invalid.</dd>
  455. <dt>403 Forbidden</dt>
  456. <dd>Access denied, wrong API key.</dd>
  457. <dt>404 Not Found</dt>
  458. <dd>The specified check does not exist.</dd>
  459. </dl>
  460. <h3>Example Request</h3>
  461. <div class="highlight"><pre><span></span><code>curl SITE_ROOT/api/v1/checks/f618072a-7bde-4eee-af63-71a77c5723bc <span class="se">\</span>
  462. --request DELETE --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span>
  463. </code></pre></div>
  464. <h3>Example Response</h3>
  465. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  466. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  467. <span class="nt">&quot;desc&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
  468. <span class="nt">&quot;grace&quot;</span><span class="p">:</span> <span class="mi">60</span><span class="p">,</span>
  469. <span class="nt">&quot;last_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  470. <span class="nt">&quot;n_pings&quot;</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  471. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;Backups&quot;</span><span class="p">,</span>
  472. <span class="nt">&quot;next_ping&quot;</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
  473. <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>
  474. <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>
  475. <span class="nt">&quot;status&quot;</span><span class="p">:</span> <span class="s2">&quot;new&quot;</span><span class="p">,</span>
  476. <span class="nt">&quot;tags&quot;</span><span class="p">:</span> <span class="s2">&quot;prod www&quot;</span><span class="p">,</span>
  477. <span class="nt">&quot;timeout&quot;</span><span class="p">:</span> <span class="mi">3600</span><span class="p">,</span>
  478. <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>
  479. <span class="p">}</span>
  480. </code></pre></div>
  481. <h2 class="rule" id="list-channels">Get a List of Existing Integrations</h2>
  482. <p><code>GET SITE_ROOT/api/v1/channels/</code></p>
  483. <p>Returns a list of integrations belonging to the user.</p>
  484. <h3>Response Codes</h3>
  485. <dl>
  486. <dt>200 OK</dt>
  487. <dd>The request succeeded.</dd>
  488. <dt>401 Unauthorized</dt>
  489. <dd>The API key is either missing or invalid.</dd>
  490. </dl>
  491. <h3>Example Request</h3>
  492. <div class="highlight"><pre><span></span><code>curl --header <span class="s2">&quot;X-Api-Key: your-api-key&quot;</span> SITE_ROOT/api/v1/channels/
  493. </code></pre></div>
  494. <h3>Example Response</h3>
  495. <div class="highlight"><pre><span></span><code><span class="p">{</span>
  496. <span class="nt">&quot;channels&quot;</span><span class="p">:</span> <span class="p">[</span>
  497. <span class="p">{</span>
  498. <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>
  499. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Work Email&quot;</span><span class="p">,</span>
  500. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;email&quot;</span>
  501. <span class="p">},</span>
  502. <span class="p">{</span>
  503. <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>
  504. <span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;My Phone&quot;</span><span class="p">,</span>
  505. <span class="nt">&quot;kind&quot;</span><span class="p">:</span> <span class="s2">&quot;sms&quot;</span>
  506. <span class="p">}</span>
  507. <span class="p">]</span>
  508. <span class="p">}</span>
  509. </code></pre></div>