> ## Documentation Index
> Fetch the complete documentation index at: https://code.dcycle.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Project

> Remove a project from your organization

# Delete Project

Permanently delete a project from your organization. This will remove the project and all its entity associations (linked invoices, logistics requests, etc.).

<Warning>
  **Irreversible Action**: Deleting a project permanently removes the project and all entity-project associations. The underlying entities (invoices, logistics requests, etc.) are NOT deleted — only their link to this project is removed.
</Warning>

## Request

### Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication

  **Example:** `sk_live_1234567890abcdef`
</ParamField>

<ParamField header="x-organization-id" type="string" required>
  Your organization UUID

  **Example:** `a8315ef3-dd50-43f8-b7ce-d839e68d51fa`
</ParamField>

### Path Parameters

<ParamField path="project_id" type="string" required>
  The unique identifier (UUID) of the project to delete

  **Example:** `550e8400-e29b-41d4-a716-446655440000`
</ParamField>

## Response

Returns `204 No Content` on successful deletion. No response body is returned.

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X DELETE "https://api.dcycle.io/v1/projects/550e8400-e29b-41d4-a716-446655440000" \
    -H "x-api-key: ${DCYCLE_API_KEY}" \
    -H "x-organization-id: ${DCYCLE_ORG_ID}"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests
  import os

  api_key = os.getenv("DCYCLE_API_KEY")
  org_id = os.getenv("DCYCLE_ORG_ID")
  project_id = "550e8400-e29b-41d4-a716-446655440000"

  headers = {
      "x-api-key": api_key,
      "x-organization-id": org_id
  }

  response = requests.delete(
      f"https://api.dcycle.io/v1/projects/{project_id}",
      headers=headers
  )

  if response.status_code == 204:
      print("Project deleted successfully")
  else:
      print(f"Error: {response.text}")
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const axios = require('axios');

  const apiKey = process.env.DCYCLE_API_KEY;
  const orgId = process.env.DCYCLE_ORG_ID;
  const projectId = '550e8400-e29b-41d4-a716-446655440000';

  const headers = {
    'x-api-key': apiKey,
    'x-organization-id': orgId
  };

  axios.delete(
    `https://api.dcycle.io/v1/projects/${projectId}`,
    { headers }
  )
  .then(response => {
    if (response.status === 204) {
      console.log('Project deleted successfully');
    }
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

```
HTTP/1.1 204 No Content
```

No response body is returned.

## Common Errors

### 401 Unauthorized

**Cause:** Missing or invalid API key

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Invalid API key",
  "code": "INVALID_API_KEY"
}
```

**Solution:** Verify your API key is valid and active.

### 404 Not Found

**Cause:** Project not found or doesn't belong to your organization

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": "Project not found"
}
```

**Solution:** Verify the project ID is correct and belongs to your organization.

### 422 Validation Error

**Cause:** Invalid project ID format

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["path", "project_id"],
      "msg": "value is not a valid uuid",
      "type": "type_error.uuid"
    }
  ]
}
```

**Solution:** Ensure the project ID is a valid UUID format.

## Use Cases

### Delete with Confirmation

Verify the project details before deleting:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def delete_project_with_confirmation(project_id):
    """Delete project after reviewing its details"""
    # Get project details first
    response = requests.get(
        f"https://api.dcycle.io/v1/projects/{project_id}",
        headers=headers
    )

    if response.status_code != 200:
        print("Project not found")
        return False

    project = response.json()
    print(f"About to delete:")
    print(f"  Name: {project['name']}")
    print(f"  Type: {project['project_type']}")
    print(f"  Created: {project['created_at']}")

    confirm = input("Delete this project? (yes/no): ")
    if confirm.lower() == 'yes':
        response = requests.delete(
            f"https://api.dcycle.io/v1/projects/{project_id}",
            headers=headers
        )
        return response.status_code == 204
    return False
```

### Clean Up Completed Projects

Remove projects that have ended and are no longer needed:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import datetime

def cleanup_old_projects(months_after_end=6):
    """Delete projects that ended more than N months ago"""
    response = requests.get(
        "https://api.dcycle.io/v1/projects/extended",
        headers=headers
    )

    cutoff = datetime.date.today() - datetime.timedelta(days=months_after_end * 30)
    deleted = 0

    for project in response.json():
        if project["end_date"] and project["end_date"] < str(cutoff):
            ext = project["extended"]
            if ext["number_of_tasks"] == ext["number_of_tasks_completed"]:
                response = requests.delete(
                    f"https://api.dcycle.io/v1/projects/{project['id']}",
                    headers=headers
                )
                if response.status_code == 204:
                    deleted += 1
                    print(f"Deleted: {project['name']}")

    print(f"Total deleted: {deleted}")
```

## Best Practices

### Before Deleting

1. **Export data**: Download any project reports before deletion
2. **Unlink entities first**: If you want to preserve the entity-project links for audit, document them before deleting
3. **Check dependencies**: Ensure no active reports or dashboards depend on this project

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Update Project" icon="pencil" href="/api-reference/projects/update">
    Modify project instead of deleting
  </Card>

  <Card title="List Projects" icon="list" href="/api-reference/projects/list">
    View all projects
  </Card>

  <Card title="Get Project" icon="folder" href="/api-reference/projects/get">
    View project details before deleting
  </Card>

  <Card title="Unlink Entities" icon="link-slash" href="/api-reference/projects/unlink-entities">
    Remove entity associations without deleting the project
  </Card>
</CardGroup>
