[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Finvoices\u002Fcreate":3,"docs-tabs-entities\u002Finvoices\u002Fcreate":6},{"content":4,"lastmod":5},"\n## Create invoice\n\n`POST \u002Fv1\u002Finvoices`\n\nCreates a new invoice in CRM.\n\n## Request fields (body)\n\n| Field | Type | Description |\n|------|-----|---------|\n| `title` | string | Invoice title. If omitted, `Invoice #\u003Cid>` is used |\n| `stageId` | string | Stage. Format: `DT31_{categoryId}:{stage}`. Stage list: `GET \u002Fv1\u002Fstatuses?filter[entityId]=SMART_INVOICE_STAGE_{categoryId}` — categoryId depends on the Bitrix24 account. To find it: `GET \u002Fv1\u002Finvoices?limit=1&select=categoryId` or ask your Bitrix24 account administrator |\n| `categoryId` | number | Pipeline ID |\n| `contactId` | number | Payer contact ID. Lookup: `GET \u002Fv1\u002Fcontacts` |\n| `companyId` | number | Payer company ID. Lookup: `GET \u002Fv1\u002Fcompanies` |\n| `mycompanyId` | number | ID of your own company (the seller) issuing the invoice. Lookup: `GET \u002Fv1\u002Fcompanies` |\n| `opportunity` | number | Invoice amount |\n| `currencyId` | string | Currency. List: `GET \u002Fv1\u002Fcurrencies` |\n| `assignedById` | number | Assignee. List: `GET \u002Fv1\u002Fusers` |\n| `begindate` | datetime | Invoice start date |\n| `closedate` | datetime | Invoice payment date |\n| `accountNumber` | string | Printable invoice number |\n| `comments` | string | Comment |\n\nNo fields are required: any single field is enough to create an invoice, and the rest are filled with the Bitrix24 account defaults. An empty body is rejected with `400 EMPTY_CREATE_BODY`.\n\nFull list of fields: [GET \u002Fv1\u002Finvoices\u002Ffields](\u002Fdocs\u002Fentities\u002Finvoices\u002Ffields). User fields (`ufCrm_*`) are also accepted. Pass invoice fields flat at the JSON root: an object under `fields` is rejected with `400 NESTED_FIELDS_ENVELOPE` before creation.\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Finvoices \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\n    \"title\": \"Invoice for services\",\n    \"stageId\": \"DT31_5:N\",\n    \"contactId\": 42,\n    \"companyId\": 15,\n    \"opportunity\": 1500,\n    \"currencyId\": \"USD\",\n    \"assignedById\": 1\n  }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X POST https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Finvoices \\\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\": \"Invoice for services\",\n    \"stageId\": \"DT31_5:N\",\n    \"contactId\": 42,\n    \"companyId\": 15,\n    \"opportunity\": 1500,\n    \"currencyId\": \"USD\",\n    \"assignedById\": 1\n  }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Finvoices', {\n  method: 'POST',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({\n    title: 'Invoice for services',\n    stageId: 'DT31_5:N',\n    contactId: 42,\n    companyId: 15,\n    opportunity: 1500,\n    currencyId: 'USD',\n    assignedById: 1,\n  }),\n})\n\nconst { success, data } = await res.json()\nconsole.log('Invoice ID:', data.id)\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Finvoices', {\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: 'Invoice for services',\n    stageId: 'DT31_5:N',\n    contactId: 42,\n    companyId: 15,\n    opportunity: 1500,\n    currencyId: 'USD',\n    assignedById: 1,\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 | The created invoice in full, including the `ufCrm_*` user fields. For every field see [Invoice fields](\u002Fdocs\u002Fentities\u002Finvoices\u002Ffields) |\n\nThe invoice card URL in Bitrix24 is built from `id`:\n\n```\nhttps:\u002F\u002F\u003Cportal>.bitrix24.com\u002Fcrm\u002Ftype\u002F31\u002Fdetails\u002F\u003Cid>\u002F\n```\n\n`31` — the `entityTypeId` of the smart invoice in Bitrix24. `\u003Cportal>` — the Bitrix24 portal domain. Access is restricted by the employee's permissions in Bitrix24.\n\n## Response example\n\nKey fields are shown. For the full record see [Invoice fields](\u002Fdocs\u002Fentities\u002Finvoices\u002Ffields).\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 129,\n    \"title\": \"Invoice for services\",\n    \"stageId\": \"DT31_5:N\",\n    \"categoryId\": 5,\n    \"contactId\": 42,\n    \"companyId\": 15,\n    \"opportunity\": 1500,\n    \"currencyId\": \"USD\",\n    \"assignedById\": 1,\n    \"createdBy\": 1,\n    \"createdTime\": \"2026-08-25T08:13:37.000Z\",\n    \"updatedTime\": \"2026-08-25T08:13:37.000Z\"\n  }\n}\n```\n\n## Error response example\n\n400 — the request body is empty:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"EMPTY_CREATE_BODY\",\n    \"message\": \"Request body is empty — provide at least one field to create smartInvoice.\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 400 | `EMPTY_CREATE_BODY` | The request body is empty — at least one field is needed |\n| 400 | `NESTED_FIELDS_ENVELOPE` | The body contains an object under `fields` instead of root-level fields; the request is rejected before creation |\n| 400 | `READONLY_FIELD` | The body carries a read-only field — `id`, `createdBy`, `createdTime` or any other field marked so in [`GET \u002Fv1\u002Finvoices\u002Ffields`](\u002Fdocs\u002Fentities\u002Finvoices\u002Ffields) |\n| 403 | `SCOPE_DENIED` | The API key lacks the `crm` scope |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Working with files in CRM fields](\u002Fdocs\u002Frecipes\u002Fcrm-files)\n- [List invoices](\u002Fdocs\u002Fentities\u002Finvoices\u002Flist)\n- [Invoice fields](\u002Fdocs\u002Fentities\u002Finvoices\u002Ffields)\n- [Contacts](\u002Fdocs\u002Fentities\u002Fcontacts)\n- [Companies](\u002Fdocs\u002Fentities\u002Fcompanies)\n- [Entity API](\u002Fdocs\u002Fentity-api)\n","2026-10-15",{},1794739380720]