[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Ftasks\u002Fcreate":3,"docs-tabs-entities\u002Ftasks\u002Fcreate":6},{"content":4,"lastmod":5},"\n## Create task\n\n`POST \u002Fv1\u002Ftasks`\n\nCreates a new task. Requires at least a title and a responsible person.\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `title` | string | ★ | Task title |\n| `responsibleId` | number | ★ | Responsible person. Employee list: `GET \u002Fv1\u002Fusers` |\n| `description` | string | | Task description. Supports BB-code (`[USER=ID]Name[\u002FUSER]`, `[B]...[\u002FB]`, `[QUOTE]...[\u002FQUOTE]`) |\n| `priority` | number | | Priority: `0` — low, `1` — normal (default), `2` — high |\n| `status` | number | | Status. Defaults to `2` (pending). Full value list: `GET \u002Fv1\u002Ftasks\u002Ffields` → `fields.status.enum` |\n| `deadline` | datetime | | Deadline (ISO 8601) |\n| `startDatePlan` | datetime | | Planned start date |\n| `endDatePlan` | datetime | | Planned end date |\n| `timeEstimate` | number | | Effort estimate in seconds |\n| `groupId` | number | | Workgroup. List: `GET \u002Fv1\u002Fworkgroups` |\n| `parentId` | number | | Parent task. List: `GET \u002Fv1\u002Ftasks` |\n| `accomplices` | number[] | | Participants. Employee list: `GET \u002Fv1\u002Fusers` |\n| `auditors` | number[] | | Observers. Employee list: `GET \u002Fv1\u002Fusers` |\n| `tags` | string[] | | Task tags (an array of tag names; accepted directly on create) |\n| `xmlId` | string | | External code that matches the task to a record in your system, up to 50 characters — see the warning below the table. Look it up with `GET \u002Fv1\u002Ftasks?filter[xmlId]=\u003Cvalue>` |\n| `ufTaskWebdavFiles` | string[] | | Task files. An array of strings shaped as `n\u003Cid>`, where `id` is the file identifier from the [`POST \u002Fv1\u002Ffiles\u002Fupload`](..\u002Ffiles\u002Fupload.md) response. For example, `[\"n9759\"]`. The full rule for file fields — [Task fields](.\u002Ffields.md) |\n| `createdBy` | number | | Creator. Defaults to the key owner. An override is applied within the calling user's permissions. An existing employee only — see the warning below the table. Employee list: `GET \u002Fv1\u002Fusers` |\n| `changedBy` | number | | Service field: who last changed the task. Accepted on write — see the section below the table. Employee list: `GET \u002Fv1\u002Fusers` |\n| `closedBy` | number | | Service field: who closed the task. Accepted on write — see the section below the table. Employee list: `GET \u002Fv1\u002Fusers` |\n| `statusChangedBy` | number | | Service field: who last changed the status. Accepted on write — see the section below the table. Employee list: `GET \u002Fv1\u002Fusers` |\n| `createdDate` | datetime | | Service field: task creation date, ISO 8601. Accepted on write — see the section below the table |\n| `changedDate` | datetime | | Service field: last change date, ISO 8601. The value you send is stored instead of the current time — see the section below the table |\n| `closedDate` | datetime | | Service field: closing date, ISO 8601. Accepted on write even for a task that is not closed — see the section below the table |\n\nFull field list — [`GET \u002Fv1\u002Ftasks\u002Ffields`](.\u002Ffields.md). The fields `id`, `dateStart`, `activityDate`, `realStatus` are set by the system and are not passed in the body.\n\n### Task service fields can be set\n\nBesides `createdBy`, a create request also accepts `changedBy`, `closedBy`, `statusChangedBy`, `createdDate`, `changedDate` and `closedDate`. Bitrix24 stores the submitted values, and Vibecode is a wrapper around it that does not forbid what the platform allows. Both spellings are accepted — `createdBy` and `CREATED_BY` alike. Send one of the two rather than both: if both are present in one body, the one that comes later is applied. The same fields are accepted on [update](.\u002Fupdate.md) — that page also covers what the task log keeps and how a date without a timezone behaves.\n\n> **Pass an existing employee only.** Bitrix24 does not check that the user ID exists in `createdBy`, `changedBy`, `closedBy` or `statusChangedBy` — it stores any number. A task whose creator does not exist stops being manageable through the API: further updates and deletion are both refused, even with an administrator key and even directly in Bitrix24, bypassing Vibecode. This cannot be undone through the API. Employee list: [`GET \u002Fv1\u002Fusers`](\u002Fdocs\u002Fentities\u002Fusers).\n\n> **Important:** a title longer than 250 characters is not rejected — Bitrix24 silently truncates it to 250. Emoji are replaced with an internal escape sequence before truncation, so a title containing emoji is truncated earlier. Check `title` in the response when the title length matters.\n\n> **Important:** an `xmlId` longer than 50 characters is not rejected — only the first 50 are stored. The `filter[xmlId]` filter matches exactly, so the task cannot be found by the original longer value. To find a task after the create response is lost, send an `xmlId` of at most 50 characters, such as a 36-character UUID, and look the task up with `GET \u002Fv1\u002Ftasks?filter[xmlId]=\u003Cvalue>`.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"title\": \"Prepare the quarterly report\",\n    \"responsibleId\": 1,\n    \"priority\": 2,\n    \"deadline\": \"2026-05-19T18:00:00+00:00\"\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"title\": \"Prepare the quarterly report\",\n    \"responsibleId\": 1,\n    \"priority\": 2,\n    \"deadline\": \"2026-05-19T18:00:00+00:00\"\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    title: 'Prepare the quarterly report',\n    responsibleId: 1,\n    priority: 2,\n    deadline: '2026-05-19T18:00:00+00:00',\n  }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('New task ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Ftasks', {\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    title: 'Prepare the quarterly report',\n    responsibleId: 1,\n    priority: 2,\n    deadline: '2026-05-19T18:00:00+00:00',\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` | object | Full object of the created task (same as `GET \u002Fv1\u002Ftasks\u002F:id`) — see [Task fields](.\u002Ffields.md) |\n\nThe task card URL in Bitrix24 is built from the `id` and the employee ID:\n\n```\nhttps:\u002F\u002F\u003Cportal>.bitrix24.com\u002Fcompany\u002Fpersonal\u002Fuser\u002F\u003CresponsibleId>\u002Ftasks\u002Ftask\u002Fview\u002F\u003Cid>\u002F\n```\n\n`\u003CresponsibleId>` — the responsible person's ID (the `responsibleId` field in the response): the task opens in their personal workspace. The `user\u002F\u003C...>` segment determines whose workspace the tasks page is shown in — substitute the ID of the employee you need, for example the current one. `\u003Cportal>` — the Bitrix24 portal domain. Access is limited by the employee's permissions in Bitrix24.\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 3871,\n    \"title\": \"Prepare the quarterly report\",\n    \"description\": \"\",\n    \"status\": 2,\n    \"priority\": 2,\n    \"responsibleId\": 1,\n    \"createdBy\": 1,\n    \"createdDate\": \"2026-05-12T11:46:12.000Z\",\n    \"deadline\": \"2026-05-19T18:00:00.000Z\",\n    \"groupId\": 0,\n    \"accomplices\": [],\n    \"auditors\": [],\n    \"creator\": {\n      \"id\": \"1\",\n      \"name\": \"Current user\",\n      \"link\": \"\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002F\"\n    },\n    \"responsible\": {\n      \"id\": \"1\",\n      \"name\": \"Current user\",\n      \"link\": \"\u002Fcompany\u002Fpersonal\u002Fuser\u002F1\u002F\"\n    }\n  }\n}\n```\n\n## Error response example\n\n422 — responsible person not specified:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"BITRIX_ERROR\",\n    \"message\": \"Assignee not specified.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 422 | `BITRIX_ERROR` | Bitrix24 rejected the task creation — for example, a required field (`title` or `responsibleId`) was not passed, or a submitted value was rejected by the portal |\n| 400 | `READONLY_FIELD` | A read-only field was passed in the request body (`id`, `dateStart`, `activityDate`, `realStatus`) |\n| 400 | `INVALID_DISK_ATTACHMENT_VALUE` | A file field was passed as something other than an array of `n\u003Cid>` strings — a number, a string without the prefix, or a single string instead of an array |\n| 403 | `SCOPE_DENIED` | The API key does not have the `tasks` scope |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nThe full list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Task fields](.\u002Ffields.md)\n- [Get task](.\u002Fget.md)\n- [Update task](.\u002Fupdate.md)\n- [List tasks](.\u002Flist.md)\n- [Upload file](..\u002Ffiles\u002Fupload.md)\n- [Batch](\u002Fdocs\u002Fbatch)\n- [Limits and optimization](\u002Fdocs\u002Foptimization)\n","2026-10-19",{},1794739432414]