# Servers

## Overview of all servers

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

#### Headers

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

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

```json
[
    {
        "id": 1,
        "company_id": 1,
        "name": "Test Server",
        "identifier": "server_identifier",
        "ip_address": "143.110.208.131",
        "deleted_at": null,
        "created_at": "2024-03-04T16:19:06.000000Z",
        "updated_at": "2024-03-04T16:19:06.000000Z"
    }
]
```

{% endtab %}
{% endtabs %}

## Details of server

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

#### Query Parameters

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

#### Headers

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

{% tabs %}
{% tab title="200 The server" %}

```json
{
        "id": 1,
        "company_id": 1,
        "name": "Test Server",
        "ip_address": "143.110.208.131",
        "identifier": "server_identifier",
        "deleted_at": null,
        "created_at": "2024-03-04T16:19:06.000000Z",
        "updated_at": "2024-03-04T16:19:06.000000Z"
}
```

{% endtab %}

{% tab title="404: Not Found The server was not found" %}

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

{% endtab %}
{% endtabs %}

## Create a new server

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

#### Headers

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

#### Request Body

| Name                                          | Type   | Description                  |
| --------------------------------------------- | ------ | ---------------------------- |
| name<mark style="color:red;">\*</mark>        | String | The name of the server       |
| ip\_address<mark style="color:red;">\*</mark> | String | The IP Address of the server |
| identifier<mark style="color:red;">\*</mark>  | String |                              |

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

```json
{
    "name": "Test Server",
    "ip_address": "143.110.208.131",
    "identifier": "server_identifier",
    "company_id": 1,
    "updated_at": "2024-03-04T20:41:32.000000Z",
    "created_at": "2024-03-04T20:41:32.000000Z",
    "id": 4
}
```

{% endtab %}
{% endtabs %}

## Delete a server

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

#### Query Parameters

| Name                                         | Type    | Description                                     |
| -------------------------------------------- | ------- | ----------------------------------------------- |
| server\_id<mark style="color:red;">\*</mark> | Integer | The identifier of the server you want to delete |

#### Headers

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

{% tabs %}
{% tab title="200: No Content The server has been deleted successfully" %}

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

{% endtab %}

{% tab title="404: Not Found The server was not found" %}

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

{% endtab %}
{% endtabs %}

## Alert

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

#### Headers

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

#### Request Body

<table><thead><tr><th>Name</th><th width="235">Type</th><th>Description</th></tr></thead><tbody><tr><td>username<mark style="color:red;">*</mark></td><td>String</td><td>The username on the server whose back-up you want to alert</td></tr><tr><td>server_id<mark style="color:red;">*</mark></td><td>String</td><td>The identifier of the server you want to alert</td></tr><tr><td>command<mark style="color:red;">*</mark></td><td>String</td><td>The command that was altered</td></tr></tbody></table>

{% tabs %}
{% tab title="200 Success" %}

```json
{
    "success": "Alert sent"
}
```

{% endtab %}
{% endtabs %}


---

# 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/servers.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.
