Skip to main content
DELETE
/
v1
/
projects
/
{project_id}
Delete Project
const options = {
  method: 'DELETE',
  headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};

fetch('https://api.dcycle.io/v1/projects/{project_id}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Delete Project

Permanently delete a project from your organization. This will remove the project and all its entity associations (linked invoices, logistics requests, etc.).
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.

Request

Headers

x-api-key
string
required
Your API key for authenticationExample: sk_live_1234567890abcdef
x-organization-id
string
required
Your organization UUIDExample: a8315ef3-dd50-43f8-b7ce-d839e68d51fa

Path Parameters

project_id
string
required
The unique identifier (UUID) of the project to deleteExample: 550e8400-e29b-41d4-a716-446655440000

Response

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

Example

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}"

Successful Response

HTTP/1.1 204 No Content
No response body is returned.

Common Errors

401 Unauthorized

Cause: Missing or invalid API key
{
  "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
{
  "detail": "Project not found"
}
Solution: Verify the project ID is correct and belongs to your organization.

422 Validation Error

Cause: Invalid project ID format
{
  "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:
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:
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