# Projects

Project management

Source: https://keyenv.dev/docs/api/projects/

Project management

## List projects

```http
GET /api/v1/projects
```

Returns all projects the user has access to through their teams

**Operation ID:** `listProjects` &middot; **Authentication:** `Authorization: Bearer <token>`

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | List of projects | `object` |
| `401` | Authentication required | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `projects` | `object[]` |  |

### Example

```bash
curl -X GET "https://api.keyenv.dev/api/v1/projects" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```

## Create project

```http
POST /api/v1/projects
```

Creates a new project within a team. Default environments (development, staging, production) are created automatically.

**Operation ID:** `createProject` &middot; **Authentication:** `Authorization: Bearer <token>`

### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `team_id` | `string (uuid)` | yes |  |
| `name` | `string` | yes |  |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `201` | Project created | `Project` |
| `400` | Invalid request | `Error` |
| `401` | Authentication required | `Error` |
| `403` | Insufficient permissions | `Error` |
| `429` | Plan limit exceeded | `LimitError` |

### Response body (`201`)

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string (uuid)` |  |
| `team_id` | `string (uuid)` |  |
| `name` | `string` |  |
| `slug` | `string` |  |
| `created_at` | `string (date-time)` |  |

### Example

```bash
curl -X POST "https://api.keyenv.dev/api/v1/projects" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"team_id":"00000000-0000-0000-0000-000000000000","name":"string"}'
```

## Get project

```http
GET /api/v1/projects/{projectId}
```

Returns project details including environments

**Operation ID:** `getProject` &middot; **Authentication:** `Authorization: Bearer <token>`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | `string` | yes | Project UUID or slug (e.g., "my-project") |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Project details | `object` |
| `401` | Authentication required | `Error` |
| `403` | Insufficient permissions | `Error` |
| `404` | Resource not found | `Error` |

### Example

```bash
curl -X GET "https://api.keyenv.dev/api/v1/projects/{projectId}" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```

## Update project

```http
PATCH /api/v1/projects/{projectId}
```

Updates project name

**Operation ID:** `updateProject` &middot; **Authentication:** `Authorization: Bearer <token>`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | `string` | yes | Project UUID or slug (e.g., "my-project") |

### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | `string` | yes |  |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `200` | Project updated | `Project` |
| `400` | Invalid request | `Error` |
| `401` | Authentication required | `Error` |
| `403` | Insufficient permissions | `Error` |
| `404` | Resource not found | `Error` |

### Response body (`200`)

| Field | Type | Description |
| --- | --- | --- |
| `id` | `string (uuid)` |  |
| `team_id` | `string (uuid)` |  |
| `name` | `string` |  |
| `slug` | `string` |  |
| `created_at` | `string (date-time)` |  |

### Example

```bash
curl -X PATCH "https://api.keyenv.dev/api/v1/projects/{projectId}" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"string"}'
```

## Delete project

```http
DELETE /api/v1/projects/{projectId}
```

Soft deletes a project and all its environments and secrets

**Operation ID:** `deleteProject` &middot; **Authentication:** `Authorization: Bearer <token>`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | `string` | yes | Project UUID or slug (e.g., "my-project") |

### Responses

| Status | Description | Body |
| --- | --- | --- |
| `204` | Project deleted |  |
| `401` | Authentication required | `Error` |
| `403` | Insufficient permissions | `Error` |
| `404` | Resource not found | `Error` |

### Example

```bash
curl -X DELETE "https://api.keyenv.dev/api/v1/projects/{projectId}" \
  -H "Authorization: Bearer $KEYENV_TOKEN"
```
