> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.monite.com/v2024-01-31/api/credit-notes/put-payable-credit-notes-id-line-items/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.monite.com/_mcp/server. # Replace all line items of a credit note PUT https://api.sandbox.monite.com/v1/payable_credit_notes/{credit_note_id}/line_items Content-Type: application/json Reference: https://docs.monite.com/api/credit-notes/put-payable-credit-notes-id-line-items ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.sandbox.monite.com/v1` (sandbox, default) - `https://api.monite.com/v1` (eu_production) - `https://us.api.monite.com/v1` (na_production) ## Request ### Path parameters - `credit_note_id` (string, required) ### Headers - `x-monite-version` (string, required) - `x-monite-entity-id` (string, required) — The ID of the entity that owns the requested resource. ### Body (application/json) This endpoint expects an object. - `data` (list of CreditNoteLineItemCreateRequest, required) — List of credit note line items to replace existing ones ## Response ### 200 Successful Response - `data` (list of CreditNoteLineItemResponse, required) — List of credit note line items for the current page - `next_pagination_token` (string, optional) — Token to retrieve the next page of results - `prev_pagination_token` (string, optional) — Token to retrieve the previous page of results ## Errors ### 401 Put Payable Credit Notes ID Line Items Request Unauthorized Error Unauthorized - `error` (ErrorSchema2, required) ### 403 Put Payable Credit Notes ID Line Items Request Forbidden Error Forbidden - `error` (ErrorSchema2, required) ### 404 Put Payable Credit Notes ID Line Items Request Not Found Error Not found - `error` (ErrorSchema2, required) ### 422 Put Payable Credit Notes ID Line Items Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ### 500 Put Payable Credit Notes ID Line Items Request Internal Server Error Internal Server Error - `error` (ErrorSchema2, required) ## Types ### CreditNoteLineItemCreateRequest Schema for creating a new credit note line item. - `description` (string, optional) — Detailed description of the line item - `name` (string, optional) — Name or title of the line item - `quantity` (double, optional) — Quantity of items - `tax` (integer, optional) — VAT rate in percent [minor units](https://docs.monite.com/references/currencies#minor-units). Example: 12.5% is 1250. - `unit` (string, optional) — Unit of measurement - `unit_price` (integer, optional) — Price per unit in smallest currency unit (e.g. cents) ### CreditNoteLineItemResponse Schema for credit note line item response. Includes all fields that can be returned from the API. - `id` (string, required) — Unique identifier of the line item - `created_at` (datetime, required) — Timestamp when the line item was created - `updated_at` (datetime, required) — Timestamp when the line item was last updated - `credit_note_id` (string, required) — ID of the parent credit note - `created_by_user_id` (string, optional) — ID of the user who created the line item - `description` (string, optional) — Detailed description of the line item - `name` (string, optional) — Name or title of the line item - `quantity` (double, optional) — Quantity of items - `subtotal` (integer, optional) — Subtotal amount before tax - `tax` (integer, optional) — Tax percentage - `tax_amount` (integer, optional) — Tax amount - `total` (integer, optional) — Total amount including tax - `unit` (string, optional) — Unit of measurement - `unit_price` (integer, optional) — Price per unit in smallest currency unit ### ErrorSchema2 - `message` (string, required) ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItem ## Examples **Request** ```json { "data": [ {} ] } ``` **Response** ```json { "data": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "created_at": "2024-01-15T14:30:00Z", "updated_at": "2024-01-15T14:30:00Z", "credit_note_id": "123e4567-e89b-12d3-a456-426614174000", "created_by_user_id": "123e4567-e89b-12d3-a456-426614174000", "description": "Premium version of Product XYZ with extended warranty", "name": "Product XYZ", "quantity": 2, "subtotal": 10000, "tax": 20, "tax_amount": 2000, "total": 12000, "unit": "pieces", "unit_price": 5000 } ], "next_pagination_token": "eyJwYWdlIjoyfQ==", "prev_pagination_token": "eyJwYWdlIjoxfQ==" } ``` **SDK Code** ```python import requests url = "https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items" payload = { "data": [{}] } headers = { "x-monite-version": "2024-01-31", "x-monite-entity-id": "9d2b4c8f-2087-4738-ba91-7359683c49a4", "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items'; const options = { method: 'PUT', headers: { 'x-monite-version': '2024-01-31', 'x-monite-entity-id': '9d2b4c8f-2087-4738-ba91-7359683c49a4', Authorization: 'Bearer ', 'Content-Type': 'application/json' }, body: '{"data":[{}]}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items" payload := strings.NewReader("{\n \"data\": [\n {}\n ]\n}") req, _ := http.NewRequest("PUT", url, payload) req.Header.Add("x-monite-version", "2024-01-31") req.Header.Add("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4") req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["x-monite-version"] = '2024-01-31' request["x-monite-entity-id"] = '9d2b4c8f-2087-4738-ba91-7359683c49a4' request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"data\": [\n {}\n ]\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items") .header("x-monite-version", "2024-01-31") .header("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"data\": [\n {}\n ]\n}") .asString(); ``` ```php request('PUT', 'https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items', [ 'body' => '{ "data": [ {} ] }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', 'x-monite-entity-id' => '9d2b4c8f-2087-4738-ba91-7359683c49a4', 'x-monite-version' => '2024-01-31', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items"); var request = new RestRequest(Method.PUT); request.AddHeader("x-monite-version", "2024-01-31"); request.AddHeader("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4"); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"data\": [\n {}\n ]\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-monite-version": "2024-01-31", "x-monite-entity-id": "9d2b4c8f-2087-4738-ba91-7359683c49a4", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["data": [[]]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.monite.com/v1/payable_credit_notes/credit_note_id/line_items")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```