# Projects

In the "Projects" section, endpoints for flexible project management involving all team members are described.

The user can create several projects. The user can create any resources in these projects. It is important to note that all projects belong to a team and that all team members have access to the project.

## Create project

<mark style="color:green;">`POST`</mark> `{{BASE_URL}}/api/projects`

Create a new project, facilitating the organization of tasks and collaboration among team members.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Team ID     |

#### Headers

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

#### Request Body

| Name                                   | Type   | Description |
| -------------------------------------- | ------ | ----------- |
| data<mark style="color:red;">\*</mark> | Object |             |

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

```json
{
    "name": "dev",
    "description": "test",
    "environment": "Development",
    "purpose": "Just trying out Enclaive",
    "isDefault": false,
    "icon": 11,
    "_id": "6549fb0870c99a149c791852",
    "owner": "6548a41138406c14db33b606",
    "team": "6548a41f38406c14db33b61e",
    "createdAt": "2023-11-07T08:53:28.369Z",
    "updatedAt": "2023-11-07T08:53:28.369Z"
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>Request payload</summary>

```json
{
    "name": "dev",
    "description": "test",
    "purpose": "Just trying out Enclaive",
    "environment": "Development",
    "team": "6548a41f38406c14db33b61e",
    "icon": 11
}
```

</details>

***

## Retrieve Team Projects

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/api/teams/{id}/projects`

Retrieve all projects associated with a specific team, providing an overview of their active projects

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Team ID     |

#### Headers

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

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

```json
[
    {
        "_id": "6548a41f38406c14db33b62c",
        "name": "first-project",
        "description": "Update your project information under Settings",
        "environment": "Development",
        "purpose": "Just trying out Enclaive",
        "isDefault": false,
        "icon": 1,
        "owner": "6548a41138406c14db33b606",
        "team": "6548a41f38406c14db33b61e",
        "createdAt": "2023-11-06T08:30:23.552Z",
        "updatedAt": "2023-11-06T08:30:23.552Z"
    },
    {
        "_id": "6549f6165bc89e139c2db632",
        "name": "dev-project",
        "description": "",
        "environment": "Development",
        "purpose": "Just trying out Enclaive",
        "isDefault": false,
        "icon": 9,
        "owner": "6548a41138406c14db33b606",
        "team": "6548a41f38406c14db33b61e",
        "createdAt": "2023-11-07T08:32:22.798Z",
        "updatedAt": "2023-11-07T08:32:22.798Z"
    }
]
```

{% endtab %}
{% endtabs %}

## Retrieve Project Resources

<mark style="color:blue;">`GET`</mark> `{{BASE_URL}}/api/teams/{id}/projects/{projectId}/resources`

Retrieve all active resources within a specific project.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Team ID     |
| projectId                            | String | Project ID  |

#### Headers

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

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

```json
[
    {
        "_id": "6549ebb3fb723c0a85a5244a",
        "name": "kraud-cloud-ubuntu-1vcpu-4gb-berlin-01"
    }
]
```

{% endtab %}
{% endtabs %}

## Update project

<mark style="color:orange;">`PUT`</mark> `{{BASE_URL}}/api/projects/{id}`

Update project details, ensuring that project information remains accurate and up to date.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Project ID  |

#### Headers

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

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

```json
{
    "name": "first-project",
    "description": "Update your project information under Settings",
    "environment": "Development",
    "purpose": "Just trying out Enclaive",
    "isDefault": false,
    "icon": 1,
    "_id": "6548a41f38406c14db33b62c",
    "owner": {
        "status": 0,
        "balance": 0,
        "hubspotContactId": "131751",
        "emailVerified": true,
        "referrer": null,
        "_id": "6548a41138406c14db33b606",
        "name": "John Doe",
        "email": "john.doe@mail.com",
        "password": "$2b$08$4bDMa0IhkDutP207Xe3cC.Rmm/NcLiUhelx/g9xI2JvjWu/khp4By",
        "emailVerificationToken": "",
        "stripeId": "cus_OxIokju2aarNVm",
        "createdAt": "2023-11-06T08:30:09.166Z",
        "updatedAt": "2023-11-06T08:30:24.438Z"
    },
    "team": {
        "name": "My Team",
        "_id": "6548a41f38406c14db33b61e",
        "email": "john.doe@mail.com",
        "members": [
            {
                "user": "6548a41138406c14db33b606",
                "role": 0
            }
        ],
        "createdAt": "2023-11-06T08:30:23.529Z",
        "updatedAt": "2023-11-06T12:56:06.337Z",
        "billingSettings": "6548e2660919dc0442dc2ec7"
    },
    "createdAt": "2023-11-06T08:30:23.552Z",
    "updatedAt": "2023-11-07T08:52:28.154Z"
}
```

{% endtab %}
{% endtabs %}

## Delete project

<mark style="color:red;">`DELETE`</mark> `{{BASE_URL}}/api/teams/{id}/projects/{projectId}`

Delete a project, provided there are no active resources within it.

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String | Team ID     |
| projectId                            | String | Project ID  |

#### Headers

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

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

```json
{"message":"ok"}
```

{% 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.enclaive.cloud/enclaive-multi-cloud-platform/developers/api/client-api/projects.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.
