Hi @TheTweakyTales ,
this node has a really strange design to POST invoice data!
As @barn4k already mentioned it is not possible to add a JSON-array.
But it is possible to do it like “hardcoded”:
You can add several item-lines in this node manually and map them with your source-JSON item by item. (you have to add as much item lines as you ever expect to get + 1.)
{
“nodes”: [
{
“parameters”: {
“jsCode”: “const lineItems = [\n {\n item: 1,\n product: \“TSL-001\”, // Use Project ID as Product name\n description: \“Rushil Ranade Speaker 9/9/25\”,\n quantity: 1,\n unit_cost: 60\n },\n {\n item: 2,\n product: \“2TSL-001\”, // Use Project ID as Product name\n description: \“2Rushil Ranade Speaker 9/9/25\”,\n quantity: 2,\n unit_cost: 260\n }\n];\n\n// Return as JSON\nreturn [{ json: { line_items: lineItems } }];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-336,
-96
],
“id”: “dbb29bc3-a85c-4f3e-be82-c29918b606b5”,
“name”: “Code”
},
{
“parameters”: {
“apiVersion”: “v4”,
“resource”: “invoice”,
“additionalFields”: {},
“invoiceItemsUi”: {
“invoiceItemsValues”: [
{
“cost”: “={{ $json.line_items[0].unit_cost }}”,
“description”: “={{ $json.line_items[0].product }}”,
“service”: “={{ $json.line_items[0].description }}”,
“hours”: “={{ $json.line_items[0].quantity }}”,
“taxName1”: “test1”,
“taxName2”: “test2”
},
{
“cost”: “={{ $json.line_items[1].unit_cost }}”,
“description”: “={{ $json.line_items[1].product }}”,
“service”: “={{ $json.line_items[1].description }}”,
“hours”: “={{ $json.line_items[1].quantity }}”
}
]
}
},
“type”: “n8n-nodes-base.invoiceNinja”,
“typeVersion”: 2,
“position”: [
-64,
-96
],
“id”: “0b5910f9-42a1-482e-af0b-bce4835e9d18”,
“name”: “Create an invoice”,
“credentials”: {
“invoiceNinjaApi”: {
“id”: “ZfReHvm6dIxhGPBN”,
“name”: “Invoice Ninja account”
}
}
}
],
“connections”: {
“Code”: {
“main”: [
[
{
“node”: “Create an invoice”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “4899eafb2fab96cf9ff1b247890aa6332ec458e77189f0aa0b55b2cbb85a4c41”
}
}
Another option is using a http-node to make an custom api request.
This should make it possible to pass an array with line items.