[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fdeals\u002Fproducts-add":3,"docs-tabs-entities\u002Fdeals\u002Fproducts-add":6},{"content":4,"lastmod":5},"## Add a product to a deal\n\n`POST \u002Fv1\u002Fdeals\u002F:id\u002Fproducts`\n\nAdds a single product row to a deal. Unlike `PUT \u002Fv1\u002Fdeals\u002F:id\u002Fproducts`, it does not replace existing rows.\n\n> **Field names are validated.** A field name that is not in the writable set is not dropped silently: the request is rejected with `400 INVALID_PARAMS` and the error text lists the writable names. Read-only fields that appear in product-row responses — `priceAccount`, `ownerId`, `storeId` and others — are accepted and ignored, so an object read via `GET` can be sent back as is.\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|----------|-----|:-----:|---------|\n| `id` (path) | number | yes | Deal ID. List: [`GET \u002Fv1\u002Fdeals`](\u002Fdocs\u002Fentities\u002Fdeals\u002Flist) |\n\n## Request fields (body)\n\n| Field | Type | Required | Description |\n|------|-----|:-----:|---------|\n| `productId` | number | no | Catalog product ID. If set without `productName`, the name is taken from the catalog. Catalog: [`GET \u002Fv1\u002Fproducts`](\u002Fdocs\u002Fentities\u002Fproducts\u002Flist). With neither `productId` nor `productName`, the row is created with no product and an empty name |\n| `productName` | string | no | Row name — for a free-text row with no catalog product |\n| `price` | number | no | Unit price. Without it the row is created with a zero price |\n| `quantity` | number | no | Quantity. Without it the row is created with a quantity of `1` |\n| `discountTypeId` | number | no | How the discount is set: `1` — as an amount in `discount`, `2` — as a percentage in `discountRate`. Defaults to `2` |\n| `discount` | number | no | Discount amount. Applied only when `discountTypeId` is `1` |\n| `discountRate` | number | no | Discount percentage. Applied only when `discountTypeId` is `2` |\n| `taxRate` | number | no | Tax rate (%) |\n| `taxIncluded` | boolean | no | Tax included in the price |\n| `measureCode` | number | no | Unit of measure code, for example `796` — piece. List: [`GET \u002Fv1\u002Fcatalog-measures`](\u002Fdocs\u002Fentities\u002Fcatalog-measures\u002Flist) |\n| `sort` | number | no | Sort order |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fdeals\u002F8821\u002Fproducts\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"productId\": 6967, \"price\": 25000, \"quantity\": 2 }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fdeals\u002F8821\u002Fproducts\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"productId\": 6967, \"price\": 25000, \"quantity\": 2 }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fdeals\u002F8821\u002Fproducts', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ productId: 6967, price: 25000, quantity: 2 }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Row ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fdeals\u002F8821\u002Fproducts', {\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({ productId: 6967, price: 25000, quantity: 2 }),\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 | The created product row in full, HTTP status `201`. Row fields — see [Product fields](\u002Fdocs\u002Fentities\u002Fdeals\u002Fproducts-fields) |\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 2381,\n    \"ownerId\": 8821,\n    \"ownerType\": \"D\",\n    \"productId\": 6967,\n    \"productName\": \"Parent product\",\n    \"price\": 25000,\n    \"priceAccount\": 25000,\n    \"priceExclusive\": 25000,\n    \"priceNetto\": 25000,\n    \"priceBrutto\": 25000,\n    \"quantity\": 2,\n    \"discountTypeId\": 2,\n    \"discountRate\": 0,\n    \"discount\": 0,\n    \"taxIncluded\": false,\n    \"customized\": \"Y\",\n    \"measureCode\": 796,\n    \"measureName\": \"pcs\",\n    \"sort\": 0,\n    \"xmlId\": \"sale_basket_1403\",\n    \"type\": 3,\n    \"storeId\": null\n  }\n}\n```\n\n## Error response example\n\n404 — no deal with this `id`:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Owner was not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `INVALID_PARAMS` | The body contains a field name that is not among the writable fields — see [Product fields](\u002Fdocs\u002Fentities\u002Fdeals\u002Fproducts-fields) |\n| 400 | `INVALID_PARAMS` | The body carries no writable product-row field — an empty object, or read-only fields only. The error text lists the writable names |\n| 404 | `ENTITY_NOT_FOUND` | Deal not found. The message is `Owner was not found` |\n| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only — see [access rights](\u002Fdocs\u002Faccess-rights) |\n| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope |\n| 401 | `TOKEN_MISSING` | API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Product rows](\u002Fdocs\u002Fentities\u002Fdeals\u002Fproducts-get)\n- [Set products](\u002Fdocs\u002Fentities\u002Fdeals\u002Fproducts-set)\n- [Delete a product](\u002Fdocs\u002Fentities\u002Fdeals\u002Fproducts-delete)\n- [CRM products](\u002Fdocs\u002Fentities\u002Fproducts)\n","2026-10-14",{},1794739368716]