Open Context Protocol is live! πŸš€ Read the launch post

getInvoiceitems

List all invoice items

Details

  • Method: GET
  • Path: /v1/invoiceitems
  • Operation ID: GetInvoiceitems

Parameters

{
  "created": {
    "description": "Only return invoice items that were created during the given date interval.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "customer": {
    "description": "The identifier of the customer whose invoice items to return. If none is provided, returns all invoice items.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "customer_account": {
    "description": "The identifier of the account representing the customer whose invoice items to return. If none is provided, returns all invoice items.",
    "required": false,
    "location": "query",
    "type": "string"
  },
  "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": "Only return invoice items belonging to this invoice. If none is provided, all invoice items will be returned. If specifying an invoice, no customer identifier is needed.",
    "required": false,
    "location": "query",
    "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"
  },
  "pending": {
    "description": "Set to `true` to only show pending invoice items, which are not yet attached to any invoices. Set to `false` to only show invoice items already attached to invoices. If unspecified, no filter is applied.",
    "required": false,
    "location": "query",
    "type": "boolean"
  },
  "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": {
      "items": {
        "description": "Invoice Items represent the component lines of an [invoice](https://docs.stripe.com/api/invoices). When you create an invoice item with an `invoice` field, it is attached to the specified invoice and included as [an invoice line item](https://docs.stripe.com/api/invoices/line_item) within [invoice.lines](https://docs.stripe.com/api/invoices/object#invoice_object-lines).\n\nInvoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined\nwith a [subscription](https://docs.stripe.com/api/subscriptions). Sometimes you want to add a charge or credit to a customer, but actually charge\nor credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges\n(to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.\n\nRelated guides: [Integrate with the Invoicing API](https://docs.stripe.com/invoicing/integration), [Subscription Invoices](https://docs.stripe.com/billing/invoices/subscription#adding-upcoming-invoice-items).",
        "properties": {
          "amount": {
            "description": "Amount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.",
            "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"
          },
          "customer": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/customer"
              },
              {
                "$ref": "#/components/schemas/deleted_customer"
              }
            ],
            "description": "The ID of the customer to bill for this invoice item.",
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/customer"
                },
                {
                  "$ref": "#/components/schemas/deleted_customer"
                }
              ]
            }
          },
          "customer_account": {
            "description": "The ID of the account to bill for this invoice item.",
            "maxLength": 5000,
            "nullable": true,
            "type": "string"
          },
          "date": {
            "description": "Time at which the object was created. Measured in seconds since the Unix epoch.",
            "format": "unix-time",
            "type": "integer"
          },
          "description": {
            "description": "An arbitrary string attached to the object. Often useful for displaying to users.",
            "maxLength": 5000,
            "nullable": true,
            "type": "string"
          },
          "discountable": {
            "description": "If true, discounts will apply to this invoice item. Always false for prorations.",
            "type": "boolean"
          },
          "discounts": {
            "description": "The discounts which apply to the invoice item. 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"
                  }
                ]
              }
            },
            "nullable": true,
            "type": "array"
          },
          "id": {
            "description": "Unique identifier for the object.",
            "maxLength": 5000,
            "type": "string"
          },
          "invoice": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/invoice"
              }
            ],
            "description": "The ID of the invoice this invoice item belongs to.",
            "nullable": true,
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/invoice"
                }
              ]
            }
          },
          "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.",
            "nullable": true,
            "type": "object"
          },
          "net_amount": {
            "description": "The amount after discounts, but before credits and taxes. This field is `null` for `discountable=true` items.",
            "type": "integer"
          },
          "object": {
            "description": "String representing the object's type. Objects of the same type share the same value.",
            "enum": [
              "invoiceitem"
            ],
            "type": "string"
          },
          "parent": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/billing_bill_resource_invoice_item_parents_invoice_item_parent"
              }
            ],
            "description": "The parent that generated this invoice 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": []
          },
          "pricing": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/billing_bill_resource_invoicing_pricing_pricing"
              }
            ],
            "description": "The pricing information of the invoice item.",
            "nullable": true
          },
          "proration": {
            "description": "Whether the invoice item was created automatically as a proration adjustment when the customer switched plans.",
            "type": "boolean"
          },
          "proration_details": {
            "description": "",
            "properties": {
              "discount_amounts": {
                "description": "Discount amounts applied when the proration was created.",
                "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"
                  ]
                },
                "type": "array"
              }
            },
            "required": [
              "discount_amounts"
            ],
            "title": "ProrationDetails",
            "type": "object",
            "x-expandableFields": [
              "discount_amounts"
            ]
          },
          "quantity": {
            "description": "Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for.",
            "type": "integer"
          },
          "tax_rates": {
            "description": "The tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.",
            "items": {
              "description": "Tax rates can be applied to [invoices](/invoicing/taxes/tax-rates), [subscriptions](/billing/taxes/tax-rates) and [Checkout Sessions](/payments/checkout/use-manual-tax-rates) to collect tax.\n\nRelated guide: [Tax rates](/billing/taxes/tax-rates)",
              "properties": {
                "active": {
                  "description": "Defaults to `true`. When set to `false`, this tax rate cannot be used with new applications or Checkout Sessions, but will still work for subscriptions and invoices that already have it set.",
                  "type": "boolean"
                },
                "country": {
                  "description": "Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).",
                  "maxLength": 5000,
                  "nullable": true,
                  "type": "string"
                },
                "created": {
                  "description": "Time at which the object was created. Measured in seconds since the Unix epoch.",
                  "format": "unix-time",
                  "type": "integer"
                },
                "description": {
                  "description": "An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.",
                  "maxLength": 5000,
                  "nullable": true,
                  "type": "string"
                },
                "display_name": {
                  "description": "The display name of the tax rates as it will appear to your customer on their receipt email, PDF, and the hosted invoice page.",
                  "maxLength": 5000,
                  "type": "string"
                },
                "effective_percentage": {
                  "description": "Actual/effective tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true,\nthis percentage reflects the rate actually used to calculate tax based on the product's taxability\nand whether the user is registered to collect taxes in the corresponding jurisdiction.",
                  "nullable": true,
                  "type": "number"
                },
                "flat_amount": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/tax_rate_flat_amount"
                    }
                  ],
                  "description": "The amount of the tax rate when the `rate_type` is `flat_amount`. Tax rates with `rate_type` `percentage` can vary based on the transaction, resulting in this field being `null`. This field exposes the amount and currency of the flat tax rate.",
                  "nullable": true
                },
                "id": {
                  "description": "Unique identifier for the object.",
                  "maxLength": 5000,
                  "type": "string"
                },
                "inclusive": {
                  "description": "This specifies if the tax rate is inclusive or exclusive.",
                  "type": "boolean"
                },
                "jurisdiction": {
                  "description": "The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.",
                  "maxLength": 5000,
                  "nullable": true,
                  "type": "string"
                },
                "jurisdiction_level": {
                  "description": "The level of the jurisdiction that imposes this tax rate. Will be `null` for manually defined tax rates.",
                  "enum": [
                    "city",
                    "country",
                    "county",
                    "district",
                    "multiple",
                    "state"
                  ],
                  "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.",
                  "nullable": true,
                  "type": "object"
                },
                "object": {
                  "description": "String representing the object's type. Objects of the same type share the same value.",
                  "enum": [
                    "tax_rate"
                  ],
                  "type": "string"
                },
                "percentage": {
                  "description": "Tax rate percentage out of 100. For tax calculations with automatic_tax[enabled]=true, this percentage includes the statutory tax rate of non-taxable jurisdictions.",
                  "type": "number"
                },
                "rate_type": {
                  "description": "Indicates the type of tax rate applied to the taxable amount. This value can be `null` when no tax applies to the location. This field is only present for TaxRates created by Stripe Tax.",
                  "enum": [
                    "flat_amount",
                    "percentage"
                  ],
                  "nullable": true,
                  "type": "string"
                },
                "state": {
                  "description": "[ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2), without country prefix. For example, \"NY\" for New York, United States.",
                  "maxLength": 5000,
                  "nullable": true,
                  "type": "string"
                },
                "tax_type": {
                  "description": "The high-level tax type, such as `vat` or `sales_tax`.",
                  "enum": [
                    "amusement_tax",
                    "communications_tax",
                    "gst",
                    "hst",
                    "igst",
                    "jct",
                    "lease_tax",
                    "pst",
                    "qst",
                    "retail_delivery_fee",
                    "rst",
                    "sales_tax",
                    "service_tax",
                    "vat"
                  ],
                  "nullable": true,
                  "type": "string",
                  "x-stripeBypassValidation": true
                }
              },
              "required": [
                "active",
                "created",
                "display_name",
                "id",
                "inclusive",
                "livemode",
                "object",
                "percentage"
              ],
              "title": "TaxRate",
              "type": "object",
              "x-expandableFields": [
                "flat_amount"
              ],
              "x-resourceId": "tax_rate"
            },
            "nullable": true,
            "type": "array"
          },
          "test_clock": {
            "anyOf": [
              {
                "maxLength": 5000,
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/test_helpers.test_clock"
              }
            ],
            "description": "ID of the test clock this invoice item belongs to.",
            "nullable": true,
            "x-expansionResources": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/test_helpers.test_clock"
                }
              ]
            }
          }
        },
        "required": [
          "amount",
          "currency",
          "customer",
          "date",
          "discountable",
          "id",
          "livemode",
          "object",
          "period",
          "proration",
          "quantity"
        ],
        "title": "InvoiceItem",
        "type": "object",
        "x-expandableFields": [
          "customer",
          "discounts",
          "invoice",
          "parent",
          "period",
          "pricing",
          "proration_details",
          "tax_rates",
          "test_clock"
        ],
        "x-resourceId": "invoiceitem"
      },
      "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,
      "pattern": "^/v1/invoiceitems",
      "type": "string"
    }
  },
  "required": [
    "data",
    "has_more",
    "object",
    "url"
  ],
  "title": "InvoicesItemsList",
  "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('getInvoiceitems', {
    # Add required parameters here
})