Knox Docs Sign in

API reference

Test mode. Use your secret key on your server; live processing is currently disabled.

https://api.knoxapi.com

Send form-encoded requests with Authorization: Bearer sk_test_....

Complete OpenAPI specification · Integration guide

Operations and schemas are based on the pinned Stripe OpenAPI specification (MIT). Nested object definitions and enums are available in the complete specification.

GET /v1/invoiceitems

List all invoice items

Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.

Request parameters

ParameterLocationTypeDescription
createdqueryone of multiple schemasOnly return invoice items that were created during the given date interval.
customerquerystringThe identifier of the customer whose invoice items to return. If none is provided, returns all invoice items.
customer_accountquerystringThe identifier of the account representing the customer whose invoice items to return. If none is provided, returns all invoice items.
ending_beforequerystringA 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.
expandqueryarray of stringSpecifies which fields in the response should be expanded.
invoicequerystringOnly 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.
limitqueryintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
pendingquerybooleanSet 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.
starting_afterquerystringA 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.

object. See the OpenAPI specification for the complete schema.

Responses

HTTP 200: Successful response.
FieldTypeDescription
data requiredarray of invoiceitem
has_more requiredbooleanTrue if this list has another page of items after this one that can be fetched.
object requiredstringString representing the object's type. Objects of the same type share the same value. Always has the value `list`.
url requiredstringThe URL where this list can be accessed.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
POST /v1/invoiceitems

Create an invoice item

Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.

Request parameters

FieldTypeDescription
amountintegerThe integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. Passing in a negative `amount` will reduce the `amount_due` on the invoice.
currencystringThree-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).
customerstringThe ID of the customer to bill for this invoice item.
customer_accountstringThe ID of the account representing the customer to bill for this invoice item.
descriptionstringAn arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
discountablebooleanControls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other invoice items.
discountsone of multiple schemasThe coupons and promotion codes to redeem into discounts for the invoice item or invoice line item.
expandarray of stringSpecifies which fields in the response should be expanded.
invoicestringThe ID of an existing invoice to add this invoice item to. For subscription invoices, when left blank, the invoice item will be added to the next upcoming scheduled invoice. For standalone invoices, the invoice item won't be automatically added unless you pass `pending_invoice_item_behavior: 'include'` when creating the invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice.
metadataone of multiple schemasSet 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`.
periodobjectThe 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.
price_dataobjectData used to generate a new [Price](https://docs.stripe.com/api/prices) object inline.
pricingobjectThe pricing information for the invoice item.
quantityintegerNon-negative integer. The quantity of units for the invoice item. Use `quantity_decimal` instead to provide decimal precision. This field will be deprecated in favor of `quantity_decimal` in a future version.
quantity_decimalstringNon-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
subscriptionstringThe ID of a subscription to add this invoice item to. When left blank, the invoice item is added to the next upcoming scheduled invoice. When set, scheduled invoices for subscriptions other than the specified subscription will ignore the invoice item. Use this when you want to express that an invoice item has been accrued within the context of a particular subscription.
tax_behaviorstringOnly required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
tax_codeone of multiple schemasA [tax code](https://docs.stripe.com/tax/tax-categories) ID.
tax_ratesarray of stringThe tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
unit_amount_decimalstringThe decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places.

Responses

HTTP 200: Successful response.
FieldTypeDescription
amount requiredintegerAmount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.
currency requiredstringThree-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).
customer requiredone of multiple schemasThe ID of the customer to bill for this invoice item.
customer_accountstringThe ID of the account to bill for this invoice item.
date requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
descriptionstringAn arbitrary string attached to the object. Often useful for displaying to users.
discountable requiredbooleanIf true, discounts will apply to this invoice item. Always false for prorations.
discountsarray of one of multiple schemasThe discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
frozen_fieldsarray of stringArray of field names that can't be modified. Attempting to update a frozen field returns an error.
id requiredstringUnique identifier for the object.
invoiceone of multiple schemasThe ID of the invoice this invoice item belongs to.
livemode requiredbooleanIf the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectSet 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.
net_amountintegerThe amount after discounts, but before credits and taxes. This field is `null` for `discountable=true` items.
object requiredstringString representing the object's type. Objects of the same type share the same value.
parentone of multiple schemasThe parent that generated this invoice item.
period requiredinvoice_line_item_period
pricingone of multiple schemasThe pricing information of the invoice item.
proration requiredbooleanWhether the invoice item was created automatically as a proration adjustment when the customer switched plans.
proration_detailsproration_details
quantity requiredintegerQuantity of units for the invoice item in integer format, with any decimal precision truncated. For the 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 invoice item is a proration, the quantity of the subscription that the proration was computed for.
quantity_decimal requiredstringNon-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
tax_ratesarray of tax_rateThe tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
test_clockone of multiple schemasID of the test clock this invoice item belongs to.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
DELETE /v1/invoiceitems/{invoiceitem}

Delete an invoice item

Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.

Request parameters

ParameterLocationTypeDescription
invoiceitempathstring

object. See the OpenAPI specification for the complete schema.

Responses

HTTP 200: Successful response.
FieldTypeDescription
deleted requiredbooleanAlways true for a deleted object
id requiredstringUnique identifier for the object.
object requiredstringString representing the object's type. Objects of the same type share the same value.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
GET /v1/invoiceitems/{invoiceitem}

Retrieve an invoice item

Retrieves the invoice item with the given ID.

Request parameters

ParameterLocationTypeDescription
expandqueryarray of stringSpecifies which fields in the response should be expanded.
invoiceitempathstring

object. See the OpenAPI specification for the complete schema.

Responses

HTTP 200: Successful response.
FieldTypeDescription
amount requiredintegerAmount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.
currency requiredstringThree-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).
customer requiredone of multiple schemasThe ID of the customer to bill for this invoice item.
customer_accountstringThe ID of the account to bill for this invoice item.
date requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
descriptionstringAn arbitrary string attached to the object. Often useful for displaying to users.
discountable requiredbooleanIf true, discounts will apply to this invoice item. Always false for prorations.
discountsarray of one of multiple schemasThe discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
frozen_fieldsarray of stringArray of field names that can't be modified. Attempting to update a frozen field returns an error.
id requiredstringUnique identifier for the object.
invoiceone of multiple schemasThe ID of the invoice this invoice item belongs to.
livemode requiredbooleanIf the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectSet 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.
net_amountintegerThe amount after discounts, but before credits and taxes. This field is `null` for `discountable=true` items.
object requiredstringString representing the object's type. Objects of the same type share the same value.
parentone of multiple schemasThe parent that generated this invoice item.
period requiredinvoice_line_item_period
pricingone of multiple schemasThe pricing information of the invoice item.
proration requiredbooleanWhether the invoice item was created automatically as a proration adjustment when the customer switched plans.
proration_detailsproration_details
quantity requiredintegerQuantity of units for the invoice item in integer format, with any decimal precision truncated. For the 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 invoice item is a proration, the quantity of the subscription that the proration was computed for.
quantity_decimal requiredstringNon-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
tax_ratesarray of tax_rateThe tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
test_clockone of multiple schemasID of the test clock this invoice item belongs to.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
POST /v1/invoiceitems/{invoiceitem}

Update an invoice item

Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.

Request parameters

ParameterLocationTypeDescription
invoiceitempathstring
FieldTypeDescription
amountintegerThe 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.
descriptionstringAn arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
discountablebooleanControls whether discounts apply to this invoice item. Defaults to false for prorations or negative invoice items, and true for all other invoice items. Cannot be set to true for prorations.
discountsone of multiple schemasThe coupons, promotion codes & existing discounts which apply to the invoice item or invoice line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
expandarray of stringSpecifies which fields in the response should be expanded.
metadataone of multiple schemasSet 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`.
periodobjectThe 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.
price_dataobjectData used to generate a new [Price](https://docs.stripe.com/api/prices) object inline.
pricingobjectThe pricing information for the invoice item.
quantityintegerNon-negative integer. The quantity of units for the invoice item. Use `quantity_decimal` instead to provide decimal precision. This field will be deprecated in favor of `quantity_decimal` in a future version.
quantity_decimalstringNon-negative decimal with at most 12 decimal places. The quantity of units for the line item.
tax_behaviorstringOnly required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
tax_codeone of multiple schemasA [tax code](https://docs.stripe.com/tax/tax-categories) ID.
tax_ratesone of multiple schemasThe tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item. Pass an empty string to remove previously-defined tax rates.
unit_amount_decimalstringThe decimal unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This `unit_amount_decimal` will be multiplied by the quantity to get the full amount. Passing in a negative `unit_amount_decimal` will reduce the `amount_due` on the invoice. Accepts at most 12 decimal places.

Responses

HTTP 200: Successful response.
FieldTypeDescription
amount requiredintegerAmount (in the `currency` specified) of the invoice item. This should always be equal to `unit_amount * quantity`.
currency requiredstringThree-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).
customer requiredone of multiple schemasThe ID of the customer to bill for this invoice item.
customer_accountstringThe ID of the account to bill for this invoice item.
date requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
descriptionstringAn arbitrary string attached to the object. Often useful for displaying to users.
discountable requiredbooleanIf true, discounts will apply to this invoice item. Always false for prorations.
discountsarray of one of multiple schemasThe discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
frozen_fieldsarray of stringArray of field names that can't be modified. Attempting to update a frozen field returns an error.
id requiredstringUnique identifier for the object.
invoiceone of multiple schemasThe ID of the invoice this invoice item belongs to.
livemode requiredbooleanIf the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`.
metadataobjectSet 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.
net_amountintegerThe amount after discounts, but before credits and taxes. This field is `null` for `discountable=true` items.
object requiredstringString representing the object's type. Objects of the same type share the same value.
parentone of multiple schemasThe parent that generated this invoice item.
period requiredinvoice_line_item_period
pricingone of multiple schemasThe pricing information of the invoice item.
proration requiredbooleanWhether the invoice item was created automatically as a proration adjustment when the customer switched plans.
proration_detailsproration_details
quantity requiredintegerQuantity of units for the invoice item in integer format, with any decimal precision truncated. For the 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 invoice item is a proration, the quantity of the subscription that the proration was computed for.
quantity_decimal requiredstringNon-negative decimal with at most 12 decimal places. The quantity of units for the invoice item.
tax_ratesarray of tax_rateThe tax rates which apply to the invoice item. When set, the `default_tax_rates` on the invoice do not apply to this invoice item.
test_clockone of multiple schemasID of the test clock this invoice item belongs to.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors