[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ftasks\u002Ftime\u002Fcreate":3,"docs-tabs-entities\u002Ftasks\u002Ftime\u002Fcreate":6},{"content":4,"lastmod":5},"\n## Add a time-tracking entry\n\n`POST \u002Fv1\u002Ftasks\u002F:taskId\u002Ftime`\n\nCreates a new time-tracking entry for a task — records the seconds spent and, optionally, the author of the entry and a comment on it.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `taskId` (path) | number | yes | Task ID |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `seconds` | number | yes | Duration in seconds |\n| `comment` | string | no | Comment for the entry. When the entry is read back, it is returned in the `commentText` field |\n| `userId` | number | no | Author ID. Defaults to the API-key user. Pass only existing employee IDs from [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers) — see \"Known specifics\" |\n| `createdDate` | string | no | 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`. If the field is omitted, the entry is dated at the time it is created |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Ftime\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"seconds\": 1800,\n    \"comment\": \"Draft preparation\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Ftime\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"seconds\": 1800,\n    \"comment\": \"Draft preparation\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Ftime', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    seconds: 1800,\n    comment: 'Draft preparation',\n  }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('New entry ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\u002F289\u002Ftime', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    seconds: 1800,\n    comment: 'Draft preparation',\n  }),\n})\n\nconst { success, data } = await res.json()\n```\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `success` | boolean | Always `true` on success |\n| `data.id` | number | ID of the created entry. Use it for `GET` \u002F `PATCH` \u002F `DELETE` |\n\n## Response example\n\nHTTP 201 Created:\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 161\n  }\n}\n```\n\n## Error response example\n\n400 — the required `seconds` field was not provided:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"MISSING_PARAMS\",\n    \"message\": \"Required: seconds (number)\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `MISSING_PARAMS` | The `seconds` field was not provided |\n| 422 | `BITRIX_ERROR` | Bitrix24 returned an error (e.g. the parent task is inaccessible) |\n| 403 | `SCOPE_DENIED` | The API key lacks the `task` scope |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## Known specifics\n\n**The existence of `userId` is not validated.** The entry is saved with any `userId`, even a non-existent one, and the call returns `201`. But such a \"ghost\" entry cannot then be read, updated, or deleted — `GET`, `PATCH` and `DELETE \u002Fv1\u002Ftasks\u002F:taskId\u002Ftime\u002F:itemId` return `404 NOT_FOUND`. It remains visible only in the `GET \u002Fv1\u002Ftasks\u002F:taskId\u002Ftime` and `GET \u002Fv1\u002Ftask-time` lists, cluttering reports with no way to clean it up via the API. Pass only real employee IDs from [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers).\n\n**The response contains only `id`, without the other fields.** Unlike creating a task or comment, this method returns only the identifier. To get the full entry with `minutes`, `source`, `createdDate`, `dateStart` and `dateStop` filled in by the system, call [`GET \u002Fv1\u002Ftasks\u002F:taskId\u002Ftime\u002F:itemId`](.\u002Fget.md).\n\n## See also\n\n- [Get a time-tracking entry](.\u002Fget.md)\n- [List time-tracking entries](.\u002Flist.md)\n- [Update a time-tracking entry](.\u002Fupdate.md)\n- [Delete a time-tracking entry](.\u002Fdelete.md)\n- [Tasks](\u002Fdocs\u002Fentities\u002Ftasks)\n","2026-10-09",{},1794739438581]