Stripe: Update an invoice's line item
Stripe invoices.postInvoicesInvoiceLinesLineItemId: arguments, response, policy and SDK examples.
← Invoices operations · Get started
Operation stripe.postinvoicesinvoicelineslineitemid
Provider route: POST /v1/invoices/{invoice}/lines/{line_item_id}. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["invoices"]["postInvoicesInvoiceLinesLineItemId"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.invoices.postInvoicesInvoiceLinesLineItemId(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_stripe import StripeIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.invoices.post_invoices_invoice_lines_line_item_id(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.invoice | string | Required within parent | Maximum length: 5000 |
path.line_item_id | string | Required within parent | Maximum length: 5000 |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | Minimum length: 1 Maximum length: 255 |
body | object | Optional | Additional keys: not allowed |
body.amount | integer | Optional | The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer’s account, pass a negative amount. |
body.description | string | Optional | An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. Maximum length: 5000 |
body.discountable | boolean | Optional | Controls whether discounts apply to this line item. Defaults to false for prorations or negative line items, and true for all other line items. Cannot be set to true for prorations. |
body.discounts | JSON | Optional | The coupons, promotion codes & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts. |
body.discounts (anyOf 1) | array | Alternative | |
body.discounts (anyOf 1)[] | object | Each item | |
body.discounts (anyOf 1)[].coupon | string | Optional | Maximum length: 5000 |
body.discounts (anyOf 1)[].discount | string | Optional | Maximum length: 5000 |
body.discounts (anyOf 1)[].promotion_code | string | Optional | Maximum length: 5000 |
body.discounts (anyOf 2) | string | Alternative | One of: |
body.expand | array | Optional | Specifies which fields in the response should be expanded. |
body.expand[] | string | Each item | Maximum length: 5000 |
body.metadata | JSON | Optional | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. For [type=subscription](/api/invoices/line_item) line items, the incoming metadata specified on the request is directly used to set this value, in contrast to [type=invoiceitem](/api/invoices/line_item) line items, where any existing metadata on the invoice line is merged with the incoming data. |
body.metadata (anyOf 1) | object | Alternative | Additional keys: see wildcard field |
body.metadata (anyOf 1).* | string | Additional keys | |
body.metadata (anyOf 2) | string | Alternative | One of: |
body.period | Model | Optional | Expand Create an invoice item — request body — body period |
body.price_data | object | Optional | Data used to generate a new [Price](https://docs.stripe.com/api/prices) object inline. |
body.price_data.currency | string | Required within parent | Format: currency |
body.price_data.product | string | Optional | Maximum length: 5000 |
body.price_data.product_data | Model | Optional | Expand Update an invoice’s line item — request body — body price data product data |
body.price_data.tax_behavior | string | Optional | One of: exclusive, inclusive, unspecified |
body.price_data.unit_amount | integer | Optional | |
body.price_data.unit_amount_decimal | string | Optional | Format: decimal |
body.pricing | object | Optional | The pricing information for the invoice item. |
body.pricing.price | string | Optional | Maximum length: 5000 |
body.quantity | integer | Optional | Non-negative integer. The quantity of units for the line item. Use `quantity_decimal` instead to provide decimal precision. This field will be deprecated in favor of `quantity_decimal` in a future version. |
body.quantity_decimal | string | Optional | Non-negative decimal with at most 12 decimal places. The quantity of units for the line item. Format: decimal |
body.tax_amounts | JSON | Optional | A list of up to 20 tax amounts for this line item. This can be useful if you calculate taxes on your own or use a third-party to calculate them. You cannot set tax amounts if any line item has [tax_rates](https://docs.stripe.com/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://docs.stripe.com/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://docs.stripe.com/tax/invoicing). Pass an empty string to remove previously defined tax amounts. |
body.tax_amounts (anyOf 1) | array | Alternative | |
body.tax_amounts (anyOf 1)[] | Model | Each item | Expand Update an invoice’s line item — request body — body tax amounts array item |
body.tax_amounts (anyOf 2) | string | Alternative | One of: |
body.tax_rates | JSON | Optional | The tax rates which apply to the line item. When set, the `default_tax_rates` on the invoice do not apply to this line item. Pass an empty string to remove previously-defined tax rates. |
body.tax_rates (anyOf 1) | array | Alternative | |
body.tax_rates (anyOf 1)[] | string | Each item | Maximum length: 5000 |
body.tax_rates (anyOf 2) | string | Alternative | One of: |
Referenced models: Create an invoice item — request body — body period, Update an invoice’s line item — request body — body price data product data, Update an invoice’s line item — request body — body tax amounts array item
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Update an invoice’s line item — response body |
Referenced models: Update an invoice’s line item — response body
Schemas
Section titled “Schemas”709 more schemas are linked from the tables above, on the schema pages.
Update an invoice's line item — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Invoice Line Items represent the individual lines within an [invoice](https://docs.stripe.com/api/invoices) and only exist within the context of an invoice. Each line item is backed by either an [invoice item](https://docs.stripe.com/api/invoiceitems) or a [subscription item](https://docs.stripe.com/api/subscription_items). |
amount | JSON | Required within parent | |
amount (anyOf 1) | integer | Alternative | The amount, in cents (or local equivalent). |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
currency | string | Required within parent | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
description | JSON | Optional | |
description (anyOf 1) | string | Alternative | An arbitrary string attached to the object. Often useful for displaying to users. Maximum length: 5000 |
description (anyOf 2) | null | Alternative | |
discount_amounts | JSON | Optional | |
discount_amounts (anyOf 1) | array | Alternative | The amount of discount calculated per discount for this line item. |
discount_amounts (anyOf 1)[] | Model | Each item | Expand Void a credit note — response body — discount amounts item |
discount_amounts (anyOf 2) | null | Alternative | |
discountable | boolean | Required within parent | If true, discounts will apply to this line item. Always false for prorations. |
discounts | array | Required within parent | The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount. |
discounts[] | JSON | Each item | |
discounts[] (anyOf 1) | string | Alternative | Maximum length: 5000 |
discounts[] (anyOf 2) | Model | Alternative | Expand Get Customers Customer Discount — response body |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
invoice | JSON | Optional | |
invoice (anyOf 1) | string | Alternative | The ID of the invoice that contains this line item. Maximum length: 5000 |
invoice (anyOf 2) | null | Alternative | |
livemode | boolean | Required within parent | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
metadata | object | Required within parent | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Note that for line items with `type=subscription`, `metadata` reflects the current metadata from the subscription associated with the line item, unless the invoice line was directly updated with different metadata after creation. Additional keys: see wildcard field |
metadata.* | string | Additional keys | Maximum length: 500 |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: line_item |
parent | JSON | Optional | |
parent (anyOf 1) | JSON | Alternative | The parent that generated this line item. |
parent (anyOf 1) (anyOf 1) | Model | Alternative | Expand Update an invoice's line item — response body — parent / The parent that generated this line item / type: invoice item details, subscription item details |
parent (anyOf 2) | null | Alternative | |
period | Model | Required within parent | Expand Create an invoice item — response body — period |
pretax_credit_amounts | JSON | Optional | |
pretax_credit_amounts (anyOf 1) | array | Alternative | Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this line item. |
pretax_credit_amounts (anyOf 1)[] | Model | Each item | Expand Update an invoice's line item — response body — pretax credit amounts array item |
pretax_credit_amounts (anyOf 2) | null | Alternative | |
pricing | JSON | Optional | |
pricing (anyOf 1) | JSON | Alternative | The pricing information of the line item. |
pricing (anyOf 1) (anyOf 1) | Model | Alternative | Expand Update an invoice's line item — response body — pricing / The pricing information of the line item / type: price details |
pricing (anyOf 2) | null | Alternative | |
quantity | JSON | Optional | |
quantity (anyOf 1) | JSON | Alternative | |
quantity (anyOf 1) (anyOf 1) | integer | Alternative | Quantity of units for the invoice line item in integer format, with any decimal precision truncated. For the line item's full-precision decimal quantity, use `quantity_decimal`. This field will be deprecated in favor of `quantity_decimal` in a future version. If the line item is a proration or subscription, the quantity of the subscription that the proration was computed for. |
quantity (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
quantity (anyOf 2) | null | Alternative | |
quantity_decimal | JSON | Optional | |
quantity_decimal (anyOf 1) | string | Alternative | Non-negative decimal with at most 12 decimal places. The quantity of units for the line item. Format: decimal |
quantity_decimal (anyOf 2) | null | Alternative | |
subscription | JSON | Optional | |
subscription (anyOf 1) | JSON | Alternative | |
subscription (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
subscription (anyOf 1) (anyOf 2) | Model | Alternative | Expand Pause a subscription — response body |
subscription (anyOf 2) | null | Alternative | |
subtotal | JSON | Required within parent | |
subtotal (anyOf 1) | integer | Alternative | The subtotal of the line item, in cents (or local equivalent), before any discounts or taxes. |
subtotal (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
taxes | JSON | Optional | |
taxes (anyOf 1) | array | Alternative | The tax information of the line item. |
taxes (anyOf 1)[] | Model | Each item | Expand Update an invoice's line item — response body — taxes The tax information of the line item item |
taxes (anyOf 2) | null | Alternative |
Referenced models: Update an invoice's line item — response body — parent / The parent that generated this line item / type: invoice item details, subscription item details, Update an invoice's line item — response body — pricing / The pricing information of the line item / type: price details, Update an invoice's line item — response body — taxes The tax information of the line item item, Get Customers Customer Discount — response body, Void a credit note — response body — discount amounts item, Create an invoice item — response body — period, Update an invoice's line item — response body — pretax credit amounts array item, Pause a subscription — response body
Create an invoice item — request body — body period
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://docs.stripe.com/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://docs.stripe.com/revenue-recognition/methodology/subscriptions-and-invoicing) for details. |
end | integer | Required within parent | Format: unix-time |
start | integer | Required within parent | Format: unix-time |
Update an invoice's line item — request body — body price data product data
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
description | string | Optional | Maximum length: 40000 |
images | array | Optional | |
images[] | string | Each item | |
metadata | object | Optional | Additional keys: see wildcard field |
metadata.* | string | Additional keys | |
name | string | Required within parent | Maximum length: 5000 |
tax_code | string | Optional | Maximum length: 5000 |
tax_details | object | Optional | |
tax_details.performance_location | string | Optional | Maximum length: 5000 |
tax_details.tax_code | JSON | Optional | |
tax_details.tax_code (anyOf 1) | string | Alternative | |
tax_details.tax_code (anyOf 2) | string | Alternative | One of: |
unit_label | string | Optional | Maximum length: 12 |
Create an invoice item — response body — period
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
end | JSON | Required within parent | |
end (anyOf 1) | integer | Alternative | The end of the period, which must be greater than or equal to the start. This value is inclusive. Format: unix-time |
end (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
start | JSON | Required within parent | |
start (anyOf 1) | integer | Alternative | The start of the period. This value is inclusive. Format: unix-time |
start (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postinvoicesinvoicelineslineitemid. Catalog operation: PostInvoicesInvoiceLinesLineItemId. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Stripe-Version": "2026-09-30.endive"}