Open Context Protocol is live! 🚀 Read the launch post
postInvoicesInvoiceLinesLineItemId

postInvoicesInvoiceLinesLineItemId

Update an invoice’s line item

Details

  • Method: POST
  • Path: /v1/invoices/{invoice}/lines/{line_item_id}
  • Operation ID: PostInvoicesInvoiceLinesLineItemId

Parameters

{
  "invoice": {
    "description": "Invoice ID of line item",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "line_item_id": {
    "description": "Invoice line item ID",
    "required": true,
    "location": "path",
    "type": "string"
  }
}

Response Schema

{
  "description": "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.\n\nEach 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).",
  "properties": {
    "amount": {
      "description": "The amount, in cents (or local equivalent).",
      "type": "integer"
    },
    "currency": {
      "description": "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",
      "type": "string"
    },
    "description": {
      "description": "An arbitrary string attached to the object. Often useful for displaying to users.",
      "maxLength": 5000,
      "nullable": true,
      "type": "string"
    },
    "discount_amounts": {
      "description": "The amount of discount calculated per discount for this line item.",
      "items": {
        "description": "",
        "properties": {
          "amount": {
            "description": "The amount, in cents (or local equivalent), of the discount.",
            "type": "integer"
          },
          "discount": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/discount"
              },
              {
                "$ref": "#/components/schemas/deleted_discount"
              }
            ],
            "description": "The discount that was applied to get this discount amount.",
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/discount"
                },
                {
                  "$ref": "#/components/schemas/deleted_discount"
                }
              ]
            }
          }
        },
        "required": [
          "amount",
          "discount"
        ],
        "title": "DiscountsResourceDiscountAmount",
        "type": "object",
        "x-expandableFields": [
          "discount"
        ]
      },
      "nullable": true,
      "type": "array"
    },
    "discountable": {
      "description": "If true, discounts will apply to this line item. Always false for prorations.",
      "type": "boolean"
    },
    "discounts": {
      "description": "The discounts applied to the invoice line item. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.",
      "items": {
        "anyOf": [
          {
            "maxLength": 5000,
            "type": "string"
          },
          {
            "$ref": "#/components/schemas/discount"
          }
        ],
        "x-expansionResources": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/discount"
            }
          ]
        }
      },
      "type": "array"
    },
    "id": {
      "description": "Unique identifier for the object.",
      "maxLength": 5000,
      "type": "string"
    },
    "invoice": {
      "description": "The ID of the invoice that contains this line item.",
      "maxLength": 5000,
      "nullable": true,
      "type": "string"
    },
    "livemode": {
      "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.",
      "type": "boolean"
    },
    "metadata": {
      "additionalProperties": {
        "maxLength": 500,
        "type": "string"
      },
      "description": "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.",
      "type": "object"
    },
    "object": {
      "description": "String representing the object's type. Objects of the same type share the same value.",
      "enum": [
        "line_item"
      ],
      "type": "string"
    },
    "parent": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/billing_bill_resource_invoicing_lines_parents_invoice_line_item_parent"
        }
      ],
      "description": "The parent that generated this line item.",
      "nullable": true
    },
    "period": {
      "description": "",
      "properties": {
        "end": {
          "description": "The end of the period, which must be greater than or equal to the start. This value is inclusive.",
          "format": "unix-time",
          "type": "integer"
        },
        "start": {
          "description": "The start of the period. This value is inclusive.",
          "format": "unix-time",
          "type": "integer"
        }
      },
      "required": [
        "end",
        "start"
      ],
      "title": "InvoiceLineItemPeriod",
      "type": "object",
      "x-expandableFields": []
    },
    "pretax_credit_amounts": {
      "description": "Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this line item.",
      "items": {
        "description": "",
        "properties": {
          "amount": {
            "description": "The amount, in cents (or local equivalent), of the pretax credit amount.",
            "type": "integer"
          },
          "credit_balance_transaction": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/billing.credit_balance_transaction"
              }
            ],
            "description": "The credit balance transaction that was applied to get this pretax credit amount.",
            "nullable": true,
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/billing.credit_balance_transaction"
                }
              ]
            }
          },
          "discount": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/discount"
              },
              {
                "$ref": "#/components/schemas/deleted_discount"
              }
            ],
            "description": "The discount that was applied to get this pretax credit amount.",
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/discount"
                },
                {
                  "$ref": "#/components/schemas/deleted_discount"
                }
              ]
            }
          },
          "type": {
            "description": "Type of the pretax credit amount referenced.",
            "enum": [
              "credit_balance_transaction",
              "discount"
            ],
            "type": "string",
            "x-stripeBypassValidation": true
          }
        },
        "required": [
          "amount",
          "type"
        ],
        "title": "InvoicesResourcePretaxCreditAmount",
        "type": "object",
        "x-expandableFields": [
          "credit_balance_transaction",
          "discount"
        ]
      },
      "nullable": true,
      "type": "array"
    },
    "pricing": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/billing_bill_resource_invoicing_pricing_pricing"
        }
      ],
      "description": "The pricing information of the line item.",
      "nullable": true
    },
    "quantity": {
      "description": "The quantity of the subscription, if the line item is a subscription or a proration.",
      "nullable": true,
      "type": "integer"
    },
    "subscription": {
      "anyOf": [
        {
          "maxLength": 5000,
          "type": "string"
        },
        {
          "$ref": "#/components/schemas/subscription"
        }
      ],
      "nullable": true,
      "x-expansionResources": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/subscription"
          }
        ]
      }
    },
    "subtotal": {
      "description": "The subtotal of the line item, in cents (or local equivalent), before any discounts or taxes.",
      "type": "integer"
    },
    "taxes": {
      "description": "The tax information of the line item.",
      "items": {
        "description": "",
        "properties": {
          "amount": {
            "description": "The amount of the tax, in cents (or local equivalent).",
            "type": "integer"
          },
          "tax_behavior": {
            "description": "Whether this tax is inclusive or exclusive.",
            "enum": [
              "exclusive",
              "inclusive"
            ],
            "type": "string"
          },
          "tax_rate_details": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/billing_bill_resource_invoicing_taxes_tax_rate_details"
              }
            ],
            "description": "Additional details about the tax rate. Only present when `type` is `tax_rate_details`.",
            "nullable": true
          },
          "taxability_reason": {
            "description": "The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.",
            "enum": [
              "customer_exempt",
              "not_available",
              "not_collecting",
              "not_subject_to_tax",
              "not_supported",
              "portion_product_exempt",
              "portion_reduced_rated",
              "portion_standard_rated",
              "product_exempt",
              "product_exempt_holiday",
              "proportionally_rated",
              "reduced_rated",
              "reverse_charge",
              "standard_rated",
              "taxable_basis_reduced",
              "zero_rated"
            ],
            "type": "string",
            "x-stripeBypassValidation": true
          },
          "taxable_amount": {
            "description": "The amount on which tax is calculated, in cents (or local equivalent).",
            "nullable": true,
            "type": "integer"
          },
          "type": {
            "description": "The type of tax information.",
            "enum": [
              "tax_rate_details"
            ],
            "type": "string"
          }
        },
        "required": [
          "amount",
          "tax_behavior",
          "taxability_reason",
          "type"
        ],
        "title": "BillingBillResourceInvoicingTaxesTax",
        "type": "object",
        "x-expandableFields": [
          "tax_rate_details"
        ]
      },
      "nullable": true,
      "type": "array"
    }
  },
  "required": [
    "amount",
    "currency",
    "discountable",
    "discounts",
    "id",
    "livemode",
    "metadata",
    "object",
    "period",
    "subtotal"
  ],
  "title": "InvoiceLineItem",
  "type": "object",
  "x-expandableFields": [
    "discount_amounts",
    "discounts",
    "parent",
    "period",
    "pretax_credit_amounts",
    "pricing",
    "subscription",
    "taxes"
  ],
  "x-resourceId": "line_item"
}

Usage

from ocp_agent import OCPAgent

agent = OCPAgent()
await agent.register_api('stripe')

# Call this tool
result = await agent.call_tool('postInvoicesInvoiceLinesLineItemId', {
    # Add required parameters here
})