# Update an existing task.

`PUT /api/tasks/{id}`

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Parameters:

- `id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [UpdateTaskDTO](https://sourcey-gauzy.pages.dev/api-reference/models/updatetaskdto/index.md)

- `tenant` (optional)
  Type: object

- `tenantId` (optional)
  Type: string

- `organization` (required)
  Type: object

- `organizationId` (required)
  Type: string

- `sentTo` (optional)
  Type: string

- `deletedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `createdAt` (optional)
  Type: string, date-time
  
  The creation timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `updatedAt` (optional)
  Type: string, date-time
  
  The last update timestamp of the entity.
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `id` (optional)
  Type: string

- `isActive` (optional)
  Type: boolean
  
  default: true

- `isArchived` (optional)
  Type: boolean
  
  default: false

- `archivedAt` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2018-11-21T06:20:32.232Z"
  ```

- `title` (required)
  Type: string

- `description` (optional)
  Type: string

- `status` (required)
  Type: string

- `priority` (optional)
  Type: string

- `size` (optional)
  Type: string

- `issueType` (optional)
  Type: string

- `estimate` (optional)
  Type: number

- `dueDate` (optional)
  Type: string, date-time

- `public` (optional)
  Type: boolean

- `startDate` (optional)
  Type: string, date-time

- `resolvedAt` (optional)
  Type: string, date-time

- `version` (optional)
  Type: string

- `isDraft` (optional)
  Type: boolean

- `isScreeningTask` (optional)
  Type: boolean

- `parent` (optional)
  Reference: [Task](https://sourcey-gauzy.pages.dev/api-reference/models/task/index.md); Type: object

- `parentId` (optional)
  Type: string

- `project` (optional)
  Type: object

- `projectId` (optional)
  Type: string

- `organizationSprint` (optional)
  Type: object

- `organizationSprintId` (optional)
  Type: string

- `taskStatus` (optional)
  Type: object

- `taskStatusId` (optional)
  Type: string

- `taskSize` (optional)
  Type: object

- `taskSizeId` (optional)
  Type: string

- `taskPriority` (optional)
  Type: object

- `taskPriorityId` (optional)
  Type: string

- `taskType` (optional)
  Reference: [IssueType](https://sourcey-gauzy.pages.dev/api-reference/models/issuetype/index.md); Type: object

- `taskTypeId` (optional)
  Type: string

- `tags` (optional)
  Type: array
  
  Items:
    Type: array

- `members` (optional)
  Type: array
  
  Items:
    Type: array

- `teams` (optional)
  Type: array
  
  Items:
    Type: array

- `modules` (optional)
  Type: array
  
  Items:
    Type: array

- `mentionEmployeeIds` (optional)
  Type: array
  
  Items:
    Type: string

Responses:

- 200: The task has been successfully updated.

- 400: Invalid input.

- 401: Unauthorized

- 403: Forbidden

- 404: Task not found.

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:3000/api/tasks/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "title": "string",
  "description": "string",
  "status": "string",
  "priority": "string",
  "size": "string",
  "issueType": "string",
  "estimate": 0,
  "dueDate": "2024-01-15T09:30:00Z",
  "public": true,
  "startDate": "2024-01-15T09:30:00Z",
  "resolvedAt": "2024-01-15T09:30:00Z",
  "version": "string",
  "isDraft": true,
  "isScreeningTask": true,
  "parent": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "title": "string",
    "description": "string",
    "status": "string",
    "priority": "string",
    "size": "string",
    "issueType": "string",
    "estimate": 0,
    "dueDate": "2024-01-15T09:30:00Z",
    "public": true,
    "startDate": "2024-01-15T09:30:00Z",
    "resolvedAt": "2024-01-15T09:30:00Z",
    "version": "string",
    "isDraft": true,
    "isScreeningTask": true,
    "parentId": "string",
    "project": {},
    "projectId": "string",
    "organizationSprint": {},
    "organizationSprintId": "string",
    "taskStatus": {},
    "taskStatusId": "string",
    "taskSize": {},
    "taskSizeId": "string",
    "taskPriority": {},
    "taskPriorityId": "string",
    "taskType": {
      "deletedAt": "2018-11-21T06:20:32.232Z",
      "createdAt": "2018-11-21T06:20:32.232Z",
      "updatedAt": "2018-11-21T06:20:32.232Z",
      "id": "string",
      "isActive": true,
      "isArchived": false,
      "archivedAt": "2018-11-21T06:20:32.232Z",
      "tenantId": "string",
      "organizationId": "string",
      "name": "string",
      "value": "string",
      "description": "string",
      "icon": "string",
      "color": "string",
      "isDefault": false,
      "isSystem": false,
      "imageId": "string",
      "projectId": "string",
      "organizationTeamId": "string"
    },
    "taskTypeId": "string",
    "tags": [
      []
    ],
    "members": [
      []
    ],
    "teams": [
      []
    ],
    "modules": [
      []
    ]
  },
  "parentId": "string",
  "project": {},
  "projectId": "string",
  "organizationSprint": {},
  "organizationSprintId": "string",
  "taskStatus": {},
  "taskStatusId": "string",
  "taskSize": {},
  "taskSizeId": "string",
  "taskPriority": {},
  "taskPriorityId": "string",
  "taskType": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "name": "string",
    "value": "string",
    "description": "string",
    "icon": "string",
    "color": "string",
    "isDefault": false,
    "isSystem": false,
    "imageId": "string",
    "projectId": "string",
    "organizationTeamId": "string"
  },
  "taskTypeId": "string",
  "tags": [
    []
  ],
  "members": [
    []
  ],
  "teams": [
    []
  ],
  "modules": [
    []
  ],
  "mentionEmployeeIds": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "title": "string",
  "description": "string",
  "status": "string",
  "priority": "string",
  "size": "string",
  "issueType": "string",
  "estimate": 0,
  "dueDate": "2024-01-15T09:30:00Z",
  "public": true,
  "startDate": "2024-01-15T09:30:00Z",
  "resolvedAt": "2024-01-15T09:30:00Z",
  "version": "string",
  "isDraft": true,
  "isScreeningTask": true,
  "parent": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "title": "string",
    "description": "string",
    "status": "string",
    "priority": "string",
    "size": "string",
    "issueType": "string",
    "estimate": 0,
    "dueDate": "2024-01-15T09:30:00Z",
    "public": true,
    "startDate": "2024-01-15T09:30:00Z",
    "resolvedAt": "2024-01-15T09:30:00Z",
    "version": "string",
    "isDraft": true,
    "isScreeningTask": true,
    "parentId": "string",
    "project": {},
    "projectId": "string",
    "organizationSprint": {},
    "organizationSprintId": "string",
    "taskStatus": {},
    "taskStatusId": "string",
    "taskSize": {},
    "taskSizeId": "string",
    "taskPriority": {},
    "taskPriorityId": "string",
    "taskType": {
      "deletedAt": "2018-11-21T06:20:32.232Z",
      "createdAt": "2018-11-21T06:20:32.232Z",
      "updatedAt": "2018-11-21T06:20:32.232Z",
      "id": "string",
      "isActive": true,
      "isArchived": false,
      "archivedAt": "2018-11-21T06:20:32.232Z",
      "tenantId": "string",
      "organizationId": "string",
      "name": "string",
      "value": "string",
      "description": "string",
      "icon": "string",
      "color": "string",
      "isDefault": false,
      "isSystem": false,
      "imageId": "string",
      "projectId": "string",
      "organizationTeamId": "string"
    },
    "taskTypeId": "string",
    "tags": [
      []
    ],
    "members": [
      []
    ],
    "teams": [
      []
    ],
    "modules": [
      []
    ]
  },
  "parentId": "string",
  "project": {},
  "projectId": "string",
  "organizationSprint": {},
  "organizationSprintId": "string",
  "taskStatus": {},
  "taskStatusId": "string",
  "taskSize": {},
  "taskSizeId": "string",
  "taskPriority": {},
  "taskPriorityId": "string",
  "taskType": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "name": "string",
    "value": "string",
    "description": "string",
    "icon": "string",
    "color": "string",
    "isDefault": false,
    "isSystem": false,
    "imageId": "string",
    "projectId": "string",
    "organizationTeamId": "string"
  },
  "taskTypeId": "string",
  "tags": [
    []
  ],
  "members": [
    []
  ],
  "teams": [
    []
  ],
  "modules": [
    []
  ],
  "mentionEmployeeIds": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:3000/api/tasks/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "deletedAt": "2018-11-21T06:20:32.232Z",
  "createdAt": "2018-11-21T06:20:32.232Z",
  "updatedAt": "2018-11-21T06:20:32.232Z",
  "id": "string",
  "isActive": true,
  "isArchived": false,
  "archivedAt": "2018-11-21T06:20:32.232Z",
  "title": "string",
  "description": "string",
  "status": "string",
  "priority": "string",
  "size": "string",
  "issueType": "string",
  "estimate": 0,
  "dueDate": "2024-01-15T09:30:00Z",
  "public": true,
  "startDate": "2024-01-15T09:30:00Z",
  "resolvedAt": "2024-01-15T09:30:00Z",
  "version": "string",
  "isDraft": true,
  "isScreeningTask": true,
  "parent": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "title": "string",
    "description": "string",
    "status": "string",
    "priority": "string",
    "size": "string",
    "issueType": "string",
    "estimate": 0,
    "dueDate": "2024-01-15T09:30:00Z",
    "public": true,
    "startDate": "2024-01-15T09:30:00Z",
    "resolvedAt": "2024-01-15T09:30:00Z",
    "version": "string",
    "isDraft": true,
    "isScreeningTask": true,
    "parentId": "string",
    "project": {},
    "projectId": "string",
    "organizationSprint": {},
    "organizationSprintId": "string",
    "taskStatus": {},
    "taskStatusId": "string",
    "taskSize": {},
    "taskSizeId": "string",
    "taskPriority": {},
    "taskPriorityId": "string",
    "taskType": {
      "deletedAt": "2018-11-21T06:20:32.232Z",
      "createdAt": "2018-11-21T06:20:32.232Z",
      "updatedAt": "2018-11-21T06:20:32.232Z",
      "id": "string",
      "isActive": true,
      "isArchived": false,
      "archivedAt": "2018-11-21T06:20:32.232Z",
      "tenantId": "string",
      "organizationId": "string",
      "name": "string",
      "value": "string",
      "description": "string",
      "icon": "string",
      "color": "string",
      "isDefault": false,
      "isSystem": false,
      "imageId": "string",
      "projectId": "string",
      "organizationTeamId": "string"
    },
    "taskTypeId": "string",
    "tags": [
      []
    ],
    "members": [
      []
    ],
    "teams": [
      []
    ],
    "modules": [
      []
    ]
  },
  "parentId": "string",
  "project": {},
  "projectId": "string",
  "organizationSprint": {},
  "organizationSprintId": "string",
  "taskStatus": {},
  "taskStatusId": "string",
  "taskSize": {},
  "taskSizeId": "string",
  "taskPriority": {},
  "taskPriorityId": "string",
  "taskType": {
    "deletedAt": "2018-11-21T06:20:32.232Z",
    "createdAt": "2018-11-21T06:20:32.232Z",
    "updatedAt": "2018-11-21T06:20:32.232Z",
    "id": "string",
    "isActive": true,
    "isArchived": false,
    "archivedAt": "2018-11-21T06:20:32.232Z",
    "tenantId": "string",
    "organizationId": "string",
    "name": "string",
    "value": "string",
    "description": "string",
    "icon": "string",
    "color": "string",
    "isDefault": false,
    "isSystem": false,
    "imageId": "string",
    "projectId": "string",
    "organizationTeamId": "string"
  },
  "taskTypeId": "string",
  "tags": [
    []
  ],
  "members": [
    []
  ],
  "teams": [
    []
  ],
  "modules": [
    []
  ],
  "mentionEmployeeIds": [
    "string"
  ]
}'''

response = requests.put(
    'http://localhost:3000/api/tasks/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
