# SSL certificates

## Overview of all SSL certificate monitors

<mark style="color:blue;">`GET`</mark> `https://cronly.app/api/certificates`

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer: `API token` |

{% tabs %}
{% tab title="200 All of your registered certificate monitors" %}

```json
[
    {
        "id": 5,
        "company_id": 1,
        "project_id": null,
        "status": "valid",
        "last_checked_at": "2022-05-31T19:19:07.000000Z",
        "hostname": "dev.cronly.app",
        "port": 443,
        "expires_at": "2022-08-06T21:10:45.000000Z",
        "deleted_at": null,
        "created_at": "2022-05-31T19:19:07.000000Z",
        "updated_at": "2022-05-31T19:19:07.000000Z"
    }
]
```

{% endtab %}
{% endtabs %}

## Details of SSL certificate monitor

<mark style="color:blue;">`GET`</mark> `https://cronly.app/api/certificates/{id}`

#### Query Parameters

| Name                                 | Type    | Description                                |
| ------------------------------------ | ------- | ------------------------------------------ |
| id<mark style="color:red;">\*</mark> | Integer | The ID of the certificate you want to view |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer: `API token` |

{% tabs %}
{% tab title="200 The SSL certificate monitor" %}

```json
{
    "id": 5,
    "company_id": 1,
    "project_id": null,
    "status": "valid",
    "last_checked_at": "2022-05-31T19:19:07.000000Z",
    "hostname": "dev.cronly.app",
    "port": 443,
    "expires_at": "2022-08-06T21:10:45.000000Z",
    "deleted_at": null,
    "created_at": "2022-05-31T19:19:07.000000Z",
    "updated_at": "2022-05-31T19:19:07.000000Z"
}
```

{% endtab %}

{% tab title="404: Not Found The SSL certificate monitor was not found" %}

```json
{
    "error": "Certificate not found"
}
```

{% endtab %}
{% endtabs %}

## Create a new SSL certificate monitor

<mark style="color:green;">`POST`</mark> `https://cronly.app/api/certificates`

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer: `API token` |

#### Request Body

| Name                                       | Type    | Description  |
| ------------------------------------------ | ------- | ------------ |
| hostname<mark style="color:red;">\*</mark> | String  |              |
| port                                       | Integer | Default: 443 |
| project\_id                                | Integer |              |

{% tabs %}
{% tab title="200 The newly created certificate monitor" %}

```json
{
    "hostname": "google.com",
    "port": "443",
    "company_id": 1,
    "updated_at": "2022-05-31T19:39:50.000000Z",
    "created_at": "2022-05-31T19:39:50.000000Z",
    "id": 6,
    "expires_at": "2022-07-27T16:26:50.000000Z",
    "last_checked_at": "2022-05-31T19:39:50.000000Z",
    "status": "valid",
    "company": {
        "id": 1,
        "name": "Robin Martijn's Company",
        "timezone": "UTC",
        "ongoing_mails": true,
        "stripe_id": "cus_LmhqyQWUTvwA1g",
        "card_brand": "visa",
        "card_last_four": "4242",
        "card_expiration": "12/2034",
        "extra_billing_information": null,
        "trial_ends_at": null,
        "billing_address": null,
        "billing_address_line_2": null,
        "billing_city": null,
        "billing_state": null,
        "billing_postal_code": null,
        "vat_id": null,
        "receipt_emails": [],
        "billing_country": "NL",
        "slack_bot_user_id": null,
        "slack_bot_access_token": null,
        "zapier_key": "iREl82aMUKiSBYEdIXtdECj24Gq8gFjG",
        "deleted_at": null,
        "created_at": "2022-05-30T13:14:13.000000Z",
        "updated_at": "2022-05-30T13:14:37.000000Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Delete an SSL certificate monitor

<mark style="color:red;">`DELETE`</mark> `https://cronly.app/api/certificates/{id}`

#### Query Parameters

| Name                                 | Type    | Description                                |
| ------------------------------------ | ------- | ------------------------------------------ |
| id<mark style="color:red;">\*</mark> | Integer | The ID of the certificate you want to view |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer: `API token` |

{% tabs %}
{% tab title="204: No Content The SSL certificate monitor has been deleted successfully" %}

```json
{
    "success": "Certificate deleted"
}
```

{% endtab %}

{% tab title="404: Not Found The SSL certificate monitor was not found" %}

```json
{
    "error": "Certificate not found"
}
```

{% endtab %}
{% endtabs %}
