---
title: "Add a line item to an invoice"
method: POST
path: "/companies/{companyId}/invoices/{invoiceId}/line-items"
tags: ["invoices"]
---

# Add a line item to an invoice

`POST /companies/{companyId}/invoices/{invoiceId}/line-items`

## Request

- Base URL: `https://api.bokio.se/v1`
- URL: `https://api.bokio.se/v1/companies/{companyId}/invoices/{invoiceId}/line-items`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `/authorize`
    - Client credentials
    - Token URL: `/token` scopes: `invoices:write`

Adds a line item to an existing draft invoice. The item will be added last in the list of line items on the invoice.

**NOTE:** The invoice must be in draft status.

**Scope:** `invoices:write`

## Request body

- union
  - object
    - `id` integer, nullable: Should not be set for new items
    - `itemRef` object, nullable: Identifier of an existing salesItem to use as a template. `unitPrice` and `quantity` can be overridden on this line item; `description`, `productType`, `unitType`, `customUnitType`, `taxRate`, `bookkeepingAccountNumber` (and `unitPrice` when not set) come from the referenced item.
      - `id` string, uuid: Reference to existing salesItem id
      - `description` string, nullable
    - `description` string, required
    - `itemType` 'salesItem', required
    - `productType` 'goods' | 'services', required
    - `unitType` 'unspecified' | 'piece' | 'hour' | 'day' | 'month' | 'kilogram' | 'gram' | 'liter' | 'meter' | 'centimeter' | 'millimeter' | 'meterSquared' | 'meterCubic' | 'mile' | 'kilometer' | 'gigabyte' | 'hectar' | 'words' | 'year' | 'week' | 'minute' | 'megabyte' | 'ton' | 'custom': When set to `custom`, `customUnitType` is required; otherwise `customUnitType` must be omitted or null.
    - `customUnitType` string, nullable: Custom sales unit text. Required when `unitType` is `custom`; must be omitted or null otherwise.
    - `quantity` number, double, required
    - `unitPrice` number, double, required
    - `taxRate` number, double, required
    - `bookkeepingAccountNumber` integer, nullable: Use the `bookkeepingAccountNumber` field in the line items to specify an accounting account other than the account that would be automatically be selected based on the item productType, taxRate, customer and company settings. Accounts that would be automatically selected cannot be set on this field.
    - `discount` Discount, nullable: A per-line discount. Either a percentage of the line total or a fixed amount in the invoice currency.
      - `type` 'percentage' | 'amount', required: `percentage` applies `value` as a percentage of the line total; `amount` subtracts `value` as a fixed amount in the invoice currency.
      - `value` number, double, required: For `percentage`, a value that must be greater than 0 and must not exceed 100. For `amount`, a value in the invoice currency that must be greater than 0 and must not exceed the line total (`quantity` × `unitPrice`).
    - `taxReduction` LineItemTaxReduction, nullable: Tax reduction details for a line item. Only applicable to line items with productType `services` and unitType `hour` or `unspecified`.
      - `taxReductionType` 'rot' | 'rut', required: The tax reduction type for this line item. Must match the invoice-level taxReduction type.
      - `jobType` 'rotConstruction' | 'rotElectricity' | 'rotGlassPlate' | 'rotSoilWork' | 'rotSweeping' | 'rotPainting' | 'rotPlumbing' | 'rutChildServices' | 'rutDataITServices' | 'rutRemovalServices' | 'rutClothingCare' | 'rutPersonalHelpCare' | 'rutRepair' | 'rutSnow' | 'rutCleaning' | 'rutGardening' | 'rutWaterWashingOfTextiles' | 'rutFurnishing' | 'rutTransportOfHouseholdGoods' | 'rutHousingSupervision', required: The job type categorizing the work. The prefix must match the tax reduction type: - ROT types: rotConstruction, rotElectricity, rotGlassPlate, rotSoilWork, rotSweeping, rotPainting, rotPlumbing - RUT types: rutChildServices, rutDataITServices, rutRemovalServices, rutClothingCare, rutPersonalHelpCare, rutRepair, rutSnow, rutCleaning, rutGardening, rutWaterWashingOfTextiles, rutFurnishing, rutTransportOfHouseholdGoods, rutHousingSupervision
    - `reverseChargeType` 'construction' | 'null', nullable: The reverse charge type applied to this line item. Omit or set to null when reverse charge does not apply. - `construction`: Applies construction reverse charge. Only valid for service line items and cannot be combined with tax reduction.
    - `projectRef` ProjectRef, nullable: Reference to a project. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `id` string, uuid, nullable
      - `projectName` string
      - `projectNumber` string
    - `costCenterRef` CostCenterRef, nullable: Reference to a cost center tag value. Should be a valid dimension 1 tag value. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `tagId` string, uuid, nullable
      - `tagName` string
  - object
    - `id` integer, nullable: Should not be set for new items
    - `itemRef` object, nullable: Identifier of an existing descriptionOnlyItem to use as a template. The field itemType is required.
      - `id` string, uuid: Reference to existing descriptionOnlyItem id
      - `description` string, nullable
    - `description` string, required
    - `itemType` 'descriptionOnlyItem', required
    - `projectRef` ProjectRef, nullable: Reference to a project. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `id` string, uuid, nullable
      - `projectName` string
      - `projectNumber` string
    - `costCenterRef` CostCenterRef, nullable: Reference to a cost center tag value. Should be a valid dimension 1 tag value. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `tagId` string, uuid, nullable
      - `tagName` string

## Response `200`

Line item added

- union
  - object
    - `id` integer, nullable: Should not be set for new items
    - `itemRef` object, nullable: Identifier of an existing salesItem to use as a template. `unitPrice` and `quantity` can be overridden on this line item; `description`, `productType`, `unitType`, `customUnitType`, `taxRate`, `bookkeepingAccountNumber` (and `unitPrice` when not set) come from the referenced item.
      - `id` string, uuid: Reference to existing salesItem id
      - `description` string, nullable
    - `description` string, required
    - `itemType` 'salesItem', required
    - `productType` 'goods' | 'services', required
    - `unitType` 'unspecified' | 'piece' | 'hour' | 'day' | 'month' | 'kilogram' | 'gram' | 'liter' | 'meter' | 'centimeter' | 'millimeter' | 'meterSquared' | 'meterCubic' | 'mile' | 'kilometer' | 'gigabyte' | 'hectar' | 'words' | 'year' | 'week' | 'minute' | 'megabyte' | 'ton' | 'custom': When set to `custom`, `customUnitType` is required; otherwise `customUnitType` must be omitted or null.
    - `customUnitType` string, nullable: Custom sales unit text. Required when `unitType` is `custom`; must be omitted or null otherwise.
    - `quantity` number, double, required
    - `unitPrice` number, double, required
    - `taxRate` number, double, required
    - `bookkeepingAccountNumber` integer, nullable: Use the `bookkeepingAccountNumber` field in the line items to specify an accounting account other than the account that would be automatically be selected based on the item productType, taxRate, customer and company settings. Accounts that would be automatically selected cannot be set on this field.
    - `discount` Discount, nullable: A per-line discount. Either a percentage of the line total or a fixed amount in the invoice currency.
      - `type` 'percentage' | 'amount', required: `percentage` applies `value` as a percentage of the line total; `amount` subtracts `value` as a fixed amount in the invoice currency.
      - `value` number, double, required: For `percentage`, a value that must be greater than 0 and must not exceed 100. For `amount`, a value in the invoice currency that must be greater than 0 and must not exceed the line total (`quantity` × `unitPrice`).
    - `taxReduction` LineItemTaxReduction, nullable: Tax reduction details for a line item. Only applicable to line items with productType `services` and unitType `hour` or `unspecified`.
      - `taxReductionType` 'rot' | 'rut', required: The tax reduction type for this line item. Must match the invoice-level taxReduction type.
      - `jobType` 'rotConstruction' | 'rotElectricity' | 'rotGlassPlate' | 'rotSoilWork' | 'rotSweeping' | 'rotPainting' | 'rotPlumbing' | 'rutChildServices' | 'rutDataITServices' | 'rutRemovalServices' | 'rutClothingCare' | 'rutPersonalHelpCare' | 'rutRepair' | 'rutSnow' | 'rutCleaning' | 'rutGardening' | 'rutWaterWashingOfTextiles' | 'rutFurnishing' | 'rutTransportOfHouseholdGoods' | 'rutHousingSupervision', required: The job type categorizing the work. The prefix must match the tax reduction type: - ROT types: rotConstruction, rotElectricity, rotGlassPlate, rotSoilWork, rotSweeping, rotPainting, rotPlumbing - RUT types: rutChildServices, rutDataITServices, rutRemovalServices, rutClothingCare, rutPersonalHelpCare, rutRepair, rutSnow, rutCleaning, rutGardening, rutWaterWashingOfTextiles, rutFurnishing, rutTransportOfHouseholdGoods, rutHousingSupervision
    - `reverseChargeType` 'construction' | 'null', nullable: The reverse charge type applied to this line item. Omit or set to null when reverse charge does not apply. - `construction`: Applies construction reverse charge. Only valid for service line items and cannot be combined with tax reduction.
    - `projectRef` ProjectRef, nullable: Reference to a project. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `id` string, uuid, nullable
      - `projectName` string
      - `projectNumber` string
    - `costCenterRef` CostCenterRef, nullable: Reference to a cost center tag value. Should be a valid dimension 1 tag value. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `tagId` string, uuid, nullable
      - `tagName` string
  - object
    - `id` integer, nullable: Should not be set for new items
    - `itemRef` object, nullable: Identifier of an existing descriptionOnlyItem to use as a template. The field itemType is required.
      - `id` string, uuid: Reference to existing descriptionOnlyItem id
      - `description` string, nullable
    - `description` string, required
    - `itemType` 'descriptionOnlyItem', required
    - `projectRef` ProjectRef, nullable: Reference to a project. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `id` string, uuid, nullable
      - `projectName` string
      - `projectNumber` string
    - `costCenterRef` CostCenterRef, nullable: Reference to a cost center tag value. Should be a valid dimension 1 tag value. **Preview:** This field is in preview and may change or be removed before general availability. [Read the full preview policy](/reference/versioning#preview)
      - `tagId` string, uuid, nullable
      - `tagName` string

## Other responses

- `400`: Missing required information
- `404`: Invoice not found

## Changes

- **2026-11-03** `9395020f3da2`: 1 warning, 15 info
  - added the new `custom` enum value to the `oneOf[subschema #1: lineItem]/oneOf[subschema #1: salesItem]/unitType` response property for the response status `200`
  - added the new optional request property `oneOf[subschema #1: lineItem]/oneOf[subschema #1: salesItem]/costCenterRef`
  - added the new optional request property `oneOf[subschema #1: lineItem]/oneOf[subschema #1: salesItem]/customUnitType`
  - added the new optional request property `oneOf[subschema #1: lineItem]/oneOf[subschema #1: salesItem]/discount`
  - …12 more

[Operation history](https://skmtc.dev/bokio/apis/company-api/changes/companies/:companyId/invoices/:invoiceId/line-items/post.md)

---

[API](https://skmtc.dev/bokio/apis/company-api.md) - [All operations](https://skmtc.dev/bokio/apis/company-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bokio/apis/company-api/revisions/9395020f3da2?raw)
