Update prices in a recurring invoice through the API

Hi!

I’m trying to update a recurring invoice through the API. I mainly want to update the price of every item, so I tried it like this:

curl -X PUT http://my.test.installation/api/v1/recurring_invoices/xyzIDxyz \
     -H 'X-Api-Token: myAPItokenXYZ' \
     -H 'X-Requested-With:XMLHttpRequest' \
	 -H 'Content-Type:application/json' \
	 -d '{"line_items": [
            {"product_key": "Testarticle 1",
             "cost": 10.5,
             "quantitiy": 1,
             "tax_name1": "Umsatzsteuer",
             "tax_rate1": 10
            }, {
             "product_key": "Testarticle 2",
             "cost": 21,
             "quantitiy": 1,
             "tax_name1": "Umsatzsteuer",
             "tax_rate1": 20
           } ]
        }'

I thought all the balances and gross totals and taxes and whatnot would then be calculated automatically, but it doesn’t seem to work. All the other amounts get set to zero when I try this.

What am I missing here? Do I have to calculate all the other amounts in the recurring invoice myself?
(I also tried to set some additional fields like “notes” or “is_amount_discount” but nothing worked)

Hi,

@david do you have any suggestions?

Even if I calculate all the other values (like taxes and gross totals etc.) myself the following just breaks the recurring invoice and sets all the amounts to 0.

curl -X PUT http://my.test.installation/api/v1/recurring_invoices/xyzIDxyz \
     -H 'X-Api-Token: myAPItokenXYZ' \
     -H 'X-Requested-With:XMLHttpRequest' \
     -H 'Content-Type:application/json' \
     -d '{
		  "amount": 132,
		  "balance": 132,
		  "total_taxes": 12,
		  "custom_value1": "9%",
		  "custom_value2": "November",
		  "custom_value3": "2025-02-09",
		  "public_notes": "some public notes ...", 
		  "line_items": [
            {"product_key": "Artikel 1",
             "cost": 120,
             "quantitiy": 1,
             "tax_name1": "Umsatzsteuer",
             "tax_rate1": 10,
             "line_total": "120.00",
             "gross_line_total": 132,
             "tax_amount": 12
            }]
        }'

Does anyone have an idea what I’m doing wrong?
Is there another way to update the prices of a recurring invoice?

The amount and balance fields are read-only, they’re recalculated based on the line item totals.

The problem is that whatever I try it always sets everything to zero (line_total, gross_line_total, balance, amount, …).

curl -X PUT http://my.test.installation/api/v1/recurring_invoices/xyzIDxyz \
     -H 'X-Api-Token: myAPItokenXYZ' \
     -H 'X-Requested-With:XMLHttpRequest' \
	 -H 'Content-Type:application/json' \
	 -d '{"is_amount_discount": false, "line_items": [{"product_key": "Artikel 1", "cost": 200, "quantitiy": 1, "tax_name1": "Umsatzsteuer", "tax_rate1": 10}]}'

I only want to set the new cost of the item but all the other amounts of the returned invoice object are then zero.

{
  "data": [
    {
      "id": "4openg4a7A",
      ...
      "amount": 0,
      "balance": 0,
      ...
      "total_taxes": 0,
      ...
      "line_items": [
        {
          "product_key": "Artikel 1",			  
          "cost": 200,
          "quantitiy": 1,				
          "tax_name1": "Umsatzsteuer",
          "tax_rate1": 10,
          "quantity": 0,
          "type_id": "1",
          "tax_id": "1",
          "product_cost": 0,
          "notes": "",
          "discount": 0,
          "is_amount_discount": false,
          "tax_name2": "",
          "tax_rate2": 0,
          "tax_name3": "",
          "tax_rate3": 0,
          "sort_id": "0",
          "line_total": "0.00",
          "gross_line_total": 0,
          "tax_amount": 0,

... etc.

I’m think I’m missing something but I don’t know what.

It looks like you have a typo: quantitiy

Oh wow. I must have been blind.
Now it works.

Thank you so much!

Glad to hear it, thanks for the update!