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

getInvoicesInvoiceLines

Retrieve an invoice’s line items

Details

  • Method: GET
  • Path: /v1/invoices/{invoice}/lines
  • Operation ID: GetInvoicesInvoiceLines

Parameters

{
  "ending_before": {
    "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "expand": {
    "description": "Specifies which fields in the response should be expanded.",
    "required": false,
    "location": "query",
    "type": "array"
  },
  "invoice": {
    "description": "",
    "required": true,
    "location": "path",
    "type": "string"
  },
  "limit": {
    "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.",
    "required": false,
    "location": "query",
    "type": "integer"
  },
  "starting_after": {
    "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.",
    "required": false,
    "location": "query",
    "type": "string"
  }
}

Response Schema

{
  "description": "",
  "properties": {
    "data": {
      "description": "Details about each object.",
      "items": {
        "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"
      },
      "type": "array"
    },
    "has_more": {
      "description": "True if this list has another page of items after this one that can be fetched.",
      "type": "boolean"
    },
    "object": {
      "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.",
      "enum": [
        "list"
      ],
      "type": "string"
    },
    "url": {
      "description": "The URL where this list can be accessed.",
      "maxLength": 5000,
      "type": "string"
    }
  },
  "required": [
    "data",
    "has_more",
    "object",
    "url"
  ],
  "title": "InvoiceLinesList",
  "type": "object",
  "x-expandableFields": [
    "data"
  ]
}

Usage

from ocp_agent import OCPAgent

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

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