NAV
shell

Introduction

Welcome to the official documentation page of the Cronit application API. This page will give you all the information you need to interact programmatically with our tool to schedule, execute and monitor your recurring tasks through HTTP calls.

Authentication

To authorize, use this code:

curl "https://api.cronit.app/ANY_ENDPOINT" \
  -H "Authorization: YOUR_API_KEY"

The use of this API requires access to a key available in each Cronit account. To access your key, go to our application, in the Account section, Integrations part.

You will need to have access to a key in the following format:

XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

You will have to use this key to transmit it in each of your API calls, thanks to the "Authorization" header

Cron jobs

List cron jobs

curl "https://api.cronit.app/v1/crons" \
  -H "Authorization: YOUR_API_KEY"

The above command returns JSON structured like this:

[
    {
        "id": 562,
        "name": "Job name",
        "createdAt": "2022-08-24T18:59:25.000Z",
        "lastRun": "2022-08-25T19:00:49.000Z",
        "enabled": true
    }
]

This API endpoint allows you to get the list of your cron jobs.

HTTP Request

GET https://api.cronit.app/v1/crons

Run a cron job

curl "https://api.cronit.app/v1/crons/123456/run" \
  -H "Authorization: YOUR_API_KEY" -X "POST"

The above command returns JSON structured like this:

{
    "body": "Your job result",
    "status": 200,
    "dt": 1152
}

This endpoint allows you to manually run a specific job

HTTP Request

POST https://api.cronit.app/v1/crons/<CRON_ID>/run

URL Parameters

Parameter Description
ID The ID of the cron you want to run

Toggle a cron job

curl "https://api.cronit.app/v1/crons/123456/toggle" \
  -H "Authorization: YOUR_API_KEY" -X "POST"

The above command returns JSON structured like this:

{
    "id": 562,
    "name": "Job name",
    "createdAt": "2022-08-24T18:59:25.000Z",
    "lastRun": "2022-08-26T05:07:03.000Z",
    "enabled": false
}

This endpoint allows you to switch on or off a specific job

HTTP Request

POST https://api.cronit.app/v1/crons/<CRON_ID>/toggle

URL Parameters

Parameter Description
ID The ID of the cron you want to run

Users

List users

curl "https://api.cronit.app/v1/users" \
  -H "Authorization: YOUR_API_KEY"

The above command returns JSON structured like this:

[
    {
        "email": "[email protected]",
        "id": 1800
    }
]

This API endpoint allows you to get the list of Cronit users in your account.

HTTP Request

GET https://api.cronit.app/v1/users

Errors

The Cronit API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- You don't have access to the specified ressource.
404 Not Found -- The specified ressource could not be found.
405 Method Not Allowed -- You tried to access a ressource with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Too Many Requests -- You're performing too many API calls at the same time.
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.