Pinging API
A ping is an HTTP request to a check's URL. It needs no API key: the URL itself is the secret, so treat it like a password.
URLs
| URL | Signal |
|---|---|
https://staging.crony.sh/ping/<uuid> | Success |
https://staging.crony.sh/ping/<uuid>/start | The job started |
https://staging.crony.sh/ping/<uuid>/fail | Failure |
https://staging.crony.sh/ping/<uuid>/log | A log entry; the check's state does not change |
https://staging.crony.sh/ping/<uuid>/<0-255> | An exit status: 0 is success, 1 to 255 is failure |
Each form also works by slug, with the project's ping key in place of the UUID. See Auto-provisioning.
https://staging.crony.sh/ping/<ping key>/<slug>
https://staging.crony.sh/ping/<ping key>/<slug>/start
https://staging.crony.sh/ping/<ping key>/<slug>/fail
https://staging.crony.sh/ping/<ping key>/<slug>/log
https://staging.crony.sh/ping/<ping key>/<slug>/<0-255>Signals explains what each one does to a check.
Query parameters
| Parameter | Meaning |
|---|---|
rid=<uuid> | A run ID. It pairs a start signal with the success or failure that ends the same run, so overlapping runs are timed correctly. It must be a UUID. |
create=1 | On a slug URL, creates the check if the project has none with that slug. |
Methods
GET, HEAD and POST all count. A check can be set to accept only POST; it then logs any other request as ignored and does not change state. That stops link previewers and crawlers that fetch a URL from counting as a run. Responses allow any origin, so a browser page can ping, and OPTIONS preflight requests are answered.
Request body
The body of a POST is stored with the ping and shown in the check's log, so it is a good place for a job's output. Crony stores the first 10 kB on the Free plan and the first 100 kB on paid plans, and drops the rest. Every successful response carries a Ping-Body-Limit header with that limit in bytes.
tail -c 10000 /var/log/backup.log | curl -fsS -m 10 --data-binary @- https://staging.crony.sh/ping/f3a1c6e2-8d4b-4c7a-9e15-2b6d0c9a7f31Rate limit
Crony records at most 5 pings a minute for each check, and email pings count toward the same limit. The minute starts with the first ping after the previous minute ended. Pings beyond the limit answer 429 and are not recorded.
Responses
A ping URL answers with one of these, in plain text sent with Cache-Control: no-store:
| Status | Body | When |
|---|---|---|
| 200 | OK | The ping was recorded. |
| 200 | OK (ignored) | The ping was logged but did not change the check: a non-POST request to a POST-only check, a body that matched no keyword, or a paused check that resumes only by hand. |
| 201 | Created | A slug URL with create=1 created the check. |
| 400 | invalid url format | The path is one part that is not a UUID, the last part is not start, fail, log or a number from 0 to 255, or the slug is not valid. This comes before looking up the check. |
| 400 | invalid rid, expected a UUID | The rid is not a UUID. |
| 403 | check limit reached | create=1 would take the account past its plan's checks. |
| 404 | not found | No check has that UUID, no project has that ping key, the slug is unknown and create=1 was not given, or a UUID is followed by two more parts. |
| 429 | rate limited | The check has had more pings this minute than the rate limit allows, counting email pings. |
Some requests never reach the ping API's rules. An OPTIONS request answers 204 for a browser's preflight. Any other method than GET, HEAD, POST and OPTIONS, the root path, a path that ends in a slash, and a path of more than three parts answer 404 with the body 404 Not Found, in plain text without the Cache-Control and Access-Control-Allow-Origin headers.
Retry on a network error or a 5xx response, and after a minute on a 429. Any other 4xx response will not change on a retry.