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/plans

List all plans

Returns a list of your plans.

Request parameters

ParameterLocationTypeDescription
activequerybooleanOnly return plans that are active or inactive (e.g., pass `false` to list all inactive plans).
createdqueryone of multiple schemasA filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
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.
limitqueryintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
productquerystringOnly return plans for the given product.
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 planDetails about each object.
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/plans

Create a plan

You can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration.

Request parameters

FieldTypeDescription
activebooleanWhether the plan is currently available for new subscriptions. Defaults to `true`.
amountintegerA positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis.
amount_decimalstringSame as `amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set.
billing_schemestringDescribes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
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).
expandarray of stringSpecifies which fields in the response should be expanded.
idstringAn identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes.
interval requiredstringSpecifies billing frequency. Either `day`, `week`, `month` or `year`.
interval_countintegerThe number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
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`.
meterstringThe meter tracking the usage of a metered price
nicknamestringA brief description of the plan, hidden from customers.
productone of multiple schemas
tiersarray of objectEach element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
tiers_modestringDefines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.
transform_usageobjectApply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`.
trial_period_daysintegerDefault number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan).
usage_typestringConfigures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`.

Responses

HTTP 200: Successful response.
FieldTypeDescription
active requiredbooleanWhether the plan can be used for new purchases.
amountintegerThe unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`.
amount_decimalstringThe unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`.
billing_scheme requiredstringDescribes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
created requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
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).
id requiredstringUnique identifier for the object.
interval requiredstringThe frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`.
interval_count requiredintegerThe number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months.
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.
meterstringThe meter tracking the usage of a metered price
nicknamestringA brief description of the plan, hidden from customers.
object requiredstringString representing the object's type. Objects of the same type share the same value.
productone of multiple schemasThe product whose pricing this plan determines.
tiersarray of plan_tierEach element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
tiers_modestringDefines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows.
transform_usageone of multiple schemasApply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`.
trial_period_daysintegerDefault number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan).
usage_type requiredstringConfigures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
DELETE /v1/plans/{plan}

Delete a plan

Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.

Request parameters

ParameterLocationTypeDescription
planpathstring

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/plans/{plan}

Retrieve a plan

Retrieves the plan with the given ID.

Request parameters

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

object. See the OpenAPI specification for the complete schema.

Responses

HTTP 200: Successful response.
FieldTypeDescription
active requiredbooleanWhether the plan can be used for new purchases.
amountintegerThe unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`.
amount_decimalstringThe unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`.
billing_scheme requiredstringDescribes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
created requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
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).
id requiredstringUnique identifier for the object.
interval requiredstringThe frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`.
interval_count requiredintegerThe number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months.
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.
meterstringThe meter tracking the usage of a metered price
nicknamestringA brief description of the plan, hidden from customers.
object requiredstringString representing the object's type. Objects of the same type share the same value.
productone of multiple schemasThe product whose pricing this plan determines.
tiersarray of plan_tierEach element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
tiers_modestringDefines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows.
transform_usageone of multiple schemasApply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`.
trial_period_daysintegerDefault number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan).
usage_type requiredstringConfigures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors
POST /v1/plans/{plan}

Update a plan

Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or billing cycle.

Request parameters

ParameterLocationTypeDescription
planpathstring
FieldTypeDescription
activebooleanWhether the plan is currently available for new subscriptions.
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`.
nicknamestringA brief description of the plan, hidden from customers.
productstringThe product the plan belongs to. This cannot be changed once it has been used in a subscription or subscription schedule.
trial_period_daysintegerDefault number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan).

Responses

HTTP 200: Successful response.
FieldTypeDescription
active requiredbooleanWhether the plan can be used for new purchases.
amountintegerThe unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`.
amount_decimalstringThe unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`.
billing_scheme requiredstringDescribes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
created requiredintegerTime at which the object was created. Measured in seconds since the Unix epoch.
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).
id requiredstringUnique identifier for the object.
interval requiredstringThe frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`.
interval_count requiredintegerThe number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months.
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.
meterstringThe meter tracking the usage of a metered price
nicknamestringA brief description of the plan, hidden from customers.
object requiredstringString representing the object's type. Objects of the same type share the same value.
productone of multiple schemasThe product whose pricing this plan determines.
tiersarray of plan_tierEach element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
tiers_modestringDefines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows.
transform_usageone of multiple schemasApply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`.
trial_period_daysintegerDefault number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan).
usage_type requiredstringConfigures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`.
HTTP default: Error response.
FieldTypeDescription
error requiredapi_errors