# PUT /api/{parent}/{id}/items > Line Items - Replace all the lines of a document Idempotent bulk set. Every existing line of the document is removed and the supplied set is written in its place, then the document totals are recalculated. The whole payload is validated before anything is written and the write runs in a transaction, so a single bad line leaves the document untouched. An empty array is rejected with a 400 rather than clearing the document; remove lines one by one with the DELETE endpoint. - **Endpoint:** `PUT /api/{parent}/{id}/items` - **Group:** Line Items - **Since:** v1.0.0 - **Defined in:** `RestApi/Controllers/LineItemsController.php` ## Headers | Field | Type | Description | | --- | --- | --- | | `authtoken` | String | Authentication token, generated from admin area | ## Parameters | Field | Type | Required | Description | | --- | --- | --- | --- | | `parent` | String | yes | Document type owning the lines | | `id` | Number | yes | Parent document unique ID | | `items` | Object[] | yes | Mandatory non empty list of lines, in the same shape the GET returns | | `items.title` | String | yes | Mandatory line title. A description is accepted instead. | | `items.description` | String | no | Optional line description | | `items.quantity` | Number | yes | Mandatory quantity, numeric | | `items.rate` | Number | yes | Mandatory unit rate, numeric | | `items.unit_type` | String | no | Optional unit type, maximum 20 characters | | `items.sort` | Number | no | Optional display order. Defaults to the array position. | | `items.item_id` | Number | no | Optional items library ID | | `items.taxable` | Number | no | Invoices only. 1 (default) or 0. | ## Request example ```bash curl -X PUT "https://yoursite.com/index.php/api/1/123/items" \ -H "authtoken: YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "items": "...", "items.title": "...", "items.quantity": "...", "items.rate": "..." }' ``` ## Responses ### Success - Success-Response: ```json HTTP/1.1 200 OK { "status": 200, "messages": {"success": "The record has been saved."}, "saved": 2, "items": [ {"id": 12, "title": "Design work", "description": "", "quantity": 2, "unit_type": "hours", "rate": 100, "total": 200, "sort": 0, "item_id": 0, "taxable": 1} ] } ``` --- Part of the [REST API for RISE CRM](https://risecrm.themesic.com/apiguide/) documentation. Full page: https://risecrm.themesic.com/apiguide/line-items/replace-line-items/