Bulk update invoice line itemsBeta
After creating an invoice, you might want to edit multiple line items on the invoice. This guide shows you how to bulk update line items on the same invoice in a single API call, along with some restrictions. Alternatively, the Invoice & Customer Uploader app lets you upload new Customers and Invoices from a CSV file.
Interested in getting early access to Bulk Update Invoice Line Items?
Thank you! We'll be in touch soon.
Create invoice
This guide assumes that you’ve already created an invoice that contains at least one invoice line item. You can learn how by reading about integrating with the Invoicing API. The invoice must still be in a draft state.
Update line items
From here, you can update multiple line items on the same invoice based on the invoice ID and line item IDs like the following:
curl https://api.stripe.com/v1/invoices/
/update_lines \ -u{{INVOICE_ID}}: \ -d "lines[0][id]"={{LINE_ITEM_1}} \ -d "lines[0][description]"="New description" \ -d "lines[0][metadata][key]"="new value" \ -d "lines[1][id]"={{LINE_ITEM_2}} \ -d "lines[1][price]={{PRICE_ID}}" \ -d "lines[2][id]"={{LINE_ITEM_3}} \ -d "lines[2][discountable]"=truesk_test_4eC39HqLyjWDarjtT1zdp7dc
The example above updates the description and metadata for line item 1, the price for line item 2, and whether it’s discountable for line item 3.
Restrictions
There are some restrictions when using this feature
The invoice must still be in a draft state
There are two types of invoice line items
type: invoiceitem
: Generated when an invoice item is added to an invoicetype: subscription
: Automatically generated for a subscription invoice from each subscription item.
After you sign up for early access and Stripe gates you into the feature, you can see the full list of available fields to update for each line item.
While all fields are supported for
invoiceitem
line items, you can only update a small subset forsubscription
line items. Fields that are supported forsubscription
line items aretax_rates
, ordiscounts
.You can update a maximum of 50 line items in one API call. This limit is subject to change and might increase or decrease.
Invoice metadata
It’s possible to set invoice metadata in the same request as the bulk line item update:
curl https://api.stripe.com/v1/invoices/
/update_lines \ -u{{INVOICE_ID}}: \ -d "lines[0][id]"={{LINE_ITEM_1}} \ -d "lines[0][description]"="New description" \ -d "lines[1][id]"={{LINE_ITEM_1}} \ -d "lines[2][description]"="Another description" \ -d "invoice_metadata[is_processed]"="true"sk_test_4eC39HqLyjWDarjtT1zdp7dc