
## Update a time-tracking entry

`PATCH /v1/tasks/:taskId/time/:itemId`

Modifies an existing time-tracking entry. Pass only the fields you want to change.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `taskId` (path) | number | yes | Task ID. List: [`GET /v1/tasks`](/docs/entities/tasks/list) |
| `itemId` (path) | number | yes | Time-tracking entry ID. List: [`GET /v1/tasks/:taskId/time`](/docs/entities/tasks/time/list) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `seconds` | number | no | New duration in seconds. After the update, `minutes` is recalculated automatically |
| `comment` | string | no | New comment for the entry |
| `createdDate` | string | no | New date and time of the entry. Three formats are accepted: ISO 8601 with offset `2026-07-13T14:30:00+00:00`, ISO 8601 without offset `2026-07-13T14:30:00`, and a date `2026-07-13` |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/tasks/289/time/161" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "seconds": 900,
    "comment": "Refined estimate"
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/tasks/289/time/161" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "seconds": 900,
    "comment": "Refined estimate"
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/time/161', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    seconds: 900,
    comment: 'Refined estimate',
  }),
})

const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/289/time/161', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    seconds: 900,
    comment: 'Refined estimate',
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on a successful update |
| `data.id` | number | ID of the updated entry. For the other fields, see [`GET /v1/tasks/:taskId/time/:itemId`](./get.md) |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 161
  }
}
```

## Error response example

404 — the entry was not found or is inaccessible:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Time entry not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `READONLY_FIELD` | `userId` was passed — the entry's author cannot be changed (see "Known specifics") |
| 400 | `INVALID_PARAMS` | `taskId` or `itemId` is not a positive integer |
| 404 | `NOT_FOUND` | An entry with this `itemId` was not found or the parent task is inaccessible |
| 403 | `SCOPE_DENIED` | The API key lacks the `task` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](/docs/access-rights) |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

**The update applies only `seconds`, `comment` and `createdDate`.** Other body fields are ignored: an empty body, or a body with only such fields, returns `200` and leaves the entry unchanged. The exception is `userId`: a request carrying it is refused entirely, and the `seconds` and `comment` sent alongside are not saved either. The author is fixed when the entry is created. To move tracked time to another employee, delete the entry and create a new one with the desired `userId`.

## See also

- [Get a time-tracking entry](./get.md)
- [List time-tracking entries](./list.md)
- [Add an entry](./create.md)
- [Delete a time-tracking entry](./delete.md)
- [Tasks](/docs/entities/tasks)
