> For the complete documentation index, see [llms.txt](https://docs.cloudplans.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudplans.io/api-reference/plans.md).

# Plans

## List Plans

<mark style="color:green;">`GET`</mark> /v1/organizations/plans/list

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**QueryString**

| Name               | Type   | Description                          |
| ------------------ | ------ | ------------------------------------ |
| action=list\_plans | string | The action (will not be needed soon) |
| org\_id            | string | The Organization ID                  |

**Response**

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

```json
{
  "status": 200,
  "plans": [
    {
      "pauses": [
        {
          
        },
        "id": "string",
        "name": "string",
        "schedule": {
          "start": "string",
          "duration": "string",
          "timezone": "string",
          "days": ["string", "string"]
        }
      ],
      "resources": number
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Describe Plan

<mark style="color:green;">`GET`</mark> /v1/organizations/plans/describe

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**QueryString**

| Name                  | Type   | Description                          |
| --------------------- | ------ | ------------------------------------ |
| action=describe\_plan | string | The action (will not be needed soon) |
| org\_id               | string | The Organization ID                  |
| plan\_id              | string | The Plan ID                          |

**Response**

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

```json
{
  "status": 200,
  "plan": {
    "id": "string",
    "name": "string",
    "schedule": {
      "duration": "string",
      "start": "string",
      "timezone": "string",
      "days": ["M", "T", "X".....]
    }
    "resources": [
      "id": "string",
      "resource_name": "string",
      "type": "string",
      "status": "string",
      "credential": "string",
      "index": number
    ],
    "dependencies": true/false,
    "state": "string"
  }
}
```

{% endtab %}
{% endtabs %}

## Create Plan

<mark style="color:green;">`POST`</mark> /v1/organizations/plans/create?action=create\_plan

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name        | Type   | Description                                                                                                     |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------------- |
| org\_id     | string | The Organization ID                                                                                             |
| name        | string | Plan name                                                                                                       |
| description | string | Description                                                                                                     |
| timezone    | string | UTC; UTC +1; etc                                                                                                |
| schedule    | map    | <p>{</p><p>  "days": \["M", "T", "X".....], </p><p>  "duration": number,</p><p>   "start": "string"</p><p>}</p> |
| state       | string | active / inactive                                                                                               |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}

## Update Plan

<mark style="color:green;">`POST`</mark> /organizations/plans/update?action=update\_plan

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

| Name       | Type   | Description                                                                                                                                                           |
| ---------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| org\_id    | string | The Organization ID                                                                                                                                                   |
| `plan_id`  | string | The Plan ID                                                                                                                                                           |
| name       | string |                                                                                                                                                                       |
| updates    | map    | <p>{<br>    "timezone": ,</p><p>    "schedule": {</p><p>        "days": \[],</p><p>        "duration": 1-23,</p><p>        "start": 1-23,</p><p></p><p>    }<br>}</p> |
| dependancy | bool   | If the resources will respect a order and are dependant on the previous                                                                                               |
| state      | string | The Plan State                                                                                                                                                        |

**Response**

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

```json
{
  "state": 200
}
```

{% endtab %}
{% endtabs %}

## Add Resource

<mark style="color:green;">`POST`</mark> /organizations/plans/resources/add?action=add\_resource\_to\_plan

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

<table><thead><tr><th width="175">Name</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td>org_id</td><td>string</td><td>The Organization ID</td></tr><tr><td><code>plan_id</code></td><td>string</td><td>The Plan ID</td></tr><tr><td>resource</td><td>map</td><td>{<br>  "resource_id": "string",<br>  "resource_name": "string",<br>  "instanceName": "string",<br>  "type": "string",<br>  "credential": "string",<br>  "status": "string",<br>  "reason": "string",<br>  "region": for AWS only (string),<br>  "resource_group": for Azure only (string)<br>}</td></tr></tbody></table>

**Response**

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

```json
{
  "id": 1,
  "name": "John",
  "age": 30
}
```

{% endtab %}
{% endtabs %}

## Update Resources Order in Plan

<mark style="color:green;">`POST`</mark> /organizations/plans/resources/change-order?action=update\_order

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

| Name              | Type   | Description                    |
| ----------------- | ------ | ------------------------------ |
| `org_id`          | string | The Organization ID            |
| `plan_id`         | string | The Plan ID                    |
| new\_sorted\_list | list   | A sorted list of resources IDs |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}

## Delete Resource

<mark style="color:green;">`POST`</mark> /v1/organizations/plans/resources/remove?action=delete\_resource

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| `org_id`     | string | The Organization ID |
| `plan_id`    | string | The Plan  ID        |
| resource\_id | string | The Resource ID     |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}

## Update Resource

<mark style="color:green;">`POST`</mark> /v1/organizations/plans/resources/update?action=update\_resource\_in\_plan

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

| Name            | Type   | Description                   |
| --------------- | ------ | ----------------------------- |
| `org_id`        | string | The Organization ID           |
| `plan_id`       | string | The Plan ID                   |
| resource\_id    | string | The Resource ID               |
| resource\_name  | string | The Resource  Name            |
| region          | string | Optional, in case it is AWS   |
| resource\_group | string | Optional, in case it is Azure |
| status          | string | Status                        |
| credential      | string | The Credential ID             |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}

## Pause Plan

<mark style="color:green;">`POST`</mark> /v1/organizations/plans/update?action=pause\_plan

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Payload**

| Name         | Type   | Description         |
| ------------ | ------ | ------------------- |
| `org_id`     | string | The Organization ID |
| `plan_id`    | string | The Plan ID         |
| pause\_start | string | DD/MM/YYYY          |
| pause\_end   | string | DD/MM/YYYY          |
| reason       | string | The reason          |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}

## Remove Plan Pause

<mark style="color:green;">`POST`</mark> /v1/organizations/plans/update?action=remove\_pause

\<Description of the endpoint>

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name      | Type   | Description         |
| --------- | ------ | ------------------- |
| org\_id   | string | The Organization ID |
| plan\_id  | string | The Plan  ID        |
| pause\_id | string | The Pause ID        |

**Response**

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

```json
{
  "status": 200
}
```

{% endtab %}
{% endtabs %}
