# How to use the API

## General use of the API

* All requests must be sent over HTTPS.
* All requests must contain an API key (except the cron job pulse service).
* All of our server responses are in JSON format.
* The HTTP response code should always be `200`. All other response codes are system errors.
* The status value is `ok`, if successful, or `error` if there are errors in your request. The reason for an error can be found inside `reason`.

{% hint style="info" %}
To prevent abuse, please limit the maximum number of retries in case of an error. Our server might block your IP address, if we spot unusual high amounts of traffic.
{% endhint %}

{% hint style="info" %}
API keys are not safe in client-side code, like Javascript. We've chosen to use API keys to make our features accessible for a wide audience. If you want to use the API in Javascript, please consider a server side languages between your client side code and our API.
{% endhint %}

## Cron job monitor pulse (heart beat) code examples

```bash
curl "https://cronly.app/api/monitors/pulse/{token}"
```

```php
<?php
file_get_contents("https://cronly.app/api/monitors/pulse/{token}");
```

```python
import urllib2
try:
    urllib2.urlopen("https://cronly.app/api/monitors/pulse/{token}")
except Exception:
    pass
```

```typescript
var https = require('https');
https.get("https://cronly.app/api/monitors/pulse/{token}");
```
