> ## 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.

# Update Project

> Modify an existing project's details

# Update Project

Update an existing project's information. You can modify any combination of the project's fields.

<Note>
  **Full Update**: This endpoint uses `PUT` and expects all fields. Fields not included will be set to `null`. To perform a partial update, first retrieve the project with [Get Project](/api-reference/projects/get) and include all existing values along with your changes.
</Note>

## 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>

<ParamField header="Content-Type" type="string" required>
  Must be `application/json`
</ParamField>

<ParamField header="Accept-Language" type="string" default="es">
  Language for notifications and labels

  **Available values:** `es`, `en`, `fr`, `pt`, `de`, `it`, `ca`
</ParamField>

### Path Parameters

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

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

### Body Parameters

<ParamField body="name" type="string">
  Updated project name

  **Example:** `"Carbon Footprint 2024 - Final"`
</ParamField>

<ParamField body="description" type="string">
  Updated project description

  **Example:** `"Updated annual carbon footprint calculation"`
</ParamField>

<ParamField body="start_date" type="string">
  Updated start date in YYYY-MM-DD format

  **Example:** `"2024-01-01"`
</ParamField>

<ParamField body="end_date" type="string">
  Updated end date in YYYY-MM-DD format. Must be equal to or after `start_date`.

  **Example:** `"2024-12-31"`
</ParamField>

<ParamField body="responsible_user_id" type="string">
  UUID of the new responsible user

  **Example:** `"user-uuid-002"`
</ParamField>

## Response

Returns the updated project object.

<ResponseField name="id" type="string">
  Unique identifier (UUID)
</ResponseField>

See [Get Project](/api-reference/projects/get) for the complete response schema.

## Example

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X PUT "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}" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Carbon Footprint 2024 - Final",
      "description": "Finalized annual carbon footprint",
      "start_date": "2024-01-01",
      "end_date": "2024-12-31",
      "responsible_user_id": "user-uuid-002"
    }'
  ```

  ```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,
      "Content-Type": "application/json"
  }

  payload = {
      "name": "Carbon Footprint 2024 - Final",
      "description": "Finalized annual carbon footprint",
      "start_date": "2024-01-01",
      "end_date": "2024-12-31",
      "responsible_user_id": "user-uuid-002"
  }

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

  project = response.json()
  print(f"Updated: {project['name']}")
  print(f"Responsible: {project['responsible_user']['email']}")
  ```

  ```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,
    'Content-Type': 'application/json'
  };

  const payload = {
    name: 'Carbon Footprint 2024 - Final',
    description: 'Finalized annual carbon footprint',
    start_date: '2024-01-01',
    end_date: '2024-12-31',
    responsible_user_id: 'user-uuid-002'
  };

  axios.put(
    `https://api.dcycle.io/v1/projects/${projectId}`,
    payload,
    { headers }
  )
  .then(response => {
    const project = response.data;
    console.log(`Updated: ${project.name}`);
    console.log(`Responsible: ${project.responsible_user.email}`);
  })
  .catch(error => console.error(error));
  ```
</CodeGroup>

### Successful Response

**Status Code:** `200 OK`

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "organization_id": "a8315ef3-dd50-43f8-b7ce-d839e68d51fa",
  "name": "Carbon Footprint 2024 - Final",
  "description": "Finalized annual carbon footprint",
  "start_date": "2024-01-01",
  "end_date": "2024-12-31",
  "due_date": "2025-03-31",
  "project_type": "carbon_footprint",
  "methodology": "gri",
  "responsible_user_id": "user-uuid-002",
  "responsible_user": {
    "id": "user-uuid-002",
    "email": "carlos@company.com",
    "first_name": "Carlos",
    "last_name": "Lopez"
  },
  "parent": null,
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-06-25T11:00:00Z"
}
```

## 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 exists and belongs to your organization.

### 422 Validation Error

**Cause:** Invalid field values

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "detail": [
    {
      "loc": ["body", "end_date"],
      "msg": "end_date must be equal to or after start_date",
      "type": "value_error"
    }
  ]
}
```

**Solution:** Check that `end_date` is equal to or after `start_date`.

## Use Cases

### Reassign Project Responsibility

Transfer a project to a different team member:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def reassign_project(project_id, new_user_id):
    """Reassign project to a different user"""
    # Get current project data
    response = requests.get(
        f"https://api.dcycle.io/v1/projects/{project_id}",
        headers=headers
    )
    project = response.json()

    # Update with new responsible user
    response = requests.put(
        f"https://api.dcycle.io/v1/projects/{project_id}",
        headers=headers,
        json={
            "name": project["name"],
            "description": project["description"],
            "start_date": project["start_date"],
            "end_date": project["end_date"],
            "responsible_user_id": new_user_id
        }
    )
    return response.json()

updated = reassign_project(
    "550e8400-e29b-41d4-a716-446655440000",
    "new-user-uuid"
)
print(f"New responsible: {updated['responsible_user']['email']}")
```

### Extend Project Timeline

Update the project end date:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
def extend_project(project_id, new_end_date):
    """Extend a project's end date"""
    response = requests.get(
        f"https://api.dcycle.io/v1/projects/{project_id}",
        headers=headers
    )
    project = response.json()

    response = requests.put(
        f"https://api.dcycle.io/v1/projects/{project_id}",
        headers=headers,
        json={
            "name": project["name"],
            "responsible_user_id": project["responsible_user_id"],
            "start_date": project["start_date"],
            "end_date": new_end_date
        }
    )
    return response.json()

updated = extend_project(
    "550e8400-e29b-41d4-a716-446655440000",
    "2025-06-30"
)
print(f"New end date: {updated['end_date']}")
```

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Get Project" icon="folder" href="/api-reference/projects/get">
    View project details before updating
  </Card>

  <Card title="Delete Project" icon="trash" href="/api-reference/projects/delete">
    Remove a project
  </Card>

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

  <Card title="Link Entities" icon="link" href="/api-reference/projects/link-entities">
    Link entities to a project
  </Card>
</CardGroup>
