# 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}");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cronly.app/api/how-to-use-the-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
