Stripe: List all promotion codes
Stripe promotionCodes.getPromotionCodes: arguments, response, policy and SDK examples.
← Promotion codes operations · Get started
Operation stripe.getpromotioncodes
Provider route: GET /v1/promotion_codes. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["promotionCodes"]["getPromotionCodes"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.promotionCodes.getPromotionCodes(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_stripe import StripeIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.promotion_codes.get_promotion_codes(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Optional | Additional keys: not allowed |
query.active | boolean | Optional | |
query.code | string | Optional | Maximum length: 5000 |
query.coupon | string | Optional | Maximum length: 5000 |
query.created | JSON | Optional | |
query.created (anyOf 1) | object | Alternative | |
query.created (anyOf 1).gt | integer | Optional | |
query.created (anyOf 1).gte | integer | Optional | |
query.created (anyOf 1).lt | integer | Optional | |
query.created (anyOf 1).lte | integer | Optional | |
query.created (anyOf 2) | integer | Alternative | |
query.customer | string | Optional | Maximum length: 5000 |
query.customer_account | string | Optional | Maximum length: 5000 |
query.ending_before | string | Optional | Maximum length: 5000 |
query.expand | array | Optional | |
query.expand[] | string | Each item | Maximum length: 5000 |
query.limit | integer | Optional | |
query.starting_after | string | Optional | Maximum length: 5000 |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
data | array | Required within parent | |
data[] | Model | Each item | Expand Create a promotion code — response body |
has_more | boolean | Required within parent | True if this list has another page of items after this one that can be fetched. |
object | string | Required within parent | String representing the object’s type. Objects of the same type share the same value. Always has the value `list`. Known values: list |
url | string | Required within parent | The URL where this list can be accessed. Maximum length: 5000 Pattern: ^/v1/promotion_codes |
Referenced models: Create a promotion code — response body
Schemas
Section titled “Schemas”702 more schemas are linked from the tables above, on the schema pages.
Create a promotion code — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | A Promotion Code represents a customer-redeemable code for an underlying promotion. You can create multiple codes for a single promotion. If you enable promotion codes in your [customer portal configuration](https://docs.stripe.com/customer-management/configure-portal), then customers can redeem a code themselves when updating a subscription in the portal. Customers can also view the currently active promotion codes and coupons on each of their subscriptions in the portal. |
active | boolean | Required within parent | Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid. |
code | string | Required within parent | The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer. Valid characters are lower case letters (a-z), upper case letters (A-Z), digits (0-9), and dashes (-). Maximum length: 5000 |
created | JSON | Required within parent | |
created (anyOf 1) | integer | Alternative | Time at which the object was created. Measured in seconds since the Unix epoch. Format: unix-time |
created (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
customer | JSON | Optional | |
customer (anyOf 1) | JSON | Alternative | The customer who can use this promotion code. |
customer (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
customer (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a customer — response body |
customer (anyOf 1) (anyOf 3) | Model | Alternative | Expand Delete a customer — response body |
customer (anyOf 2) | null | Alternative | |
customer_account | JSON | Optional | |
customer_account (anyOf 1) | string | Alternative | The account representing the customer who can use this promotion code. Maximum length: 5000 |
customer_account (anyOf 2) | null | Alternative | |
expires_at | JSON | Optional | |
expires_at (anyOf 1) | JSON | Alternative | |
expires_at (anyOf 1) (anyOf 1) | integer | Alternative | Date at which the promotion code can no longer be redeemed. Format: unix-time |
expires_at (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
expires_at (anyOf 2) | null | Alternative | |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
livemode | boolean | Required within parent | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
max_redemptions | JSON | Optional | |
max_redemptions (anyOf 1) | JSON | Alternative | |
max_redemptions (anyOf 1) (anyOf 1) | integer | Alternative | Maximum number of times this promotion code can be redeemed. |
max_redemptions (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
max_redemptions (anyOf 2) | null | Alternative | |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | 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. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | Maximum length: 500 |
metadata (anyOf 2) | null | Alternative | |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: promotion_code |
promotion | Model | Required within parent | Expand Create a promotion code — response body — promotion |
restrictions | Model | Required within parent | Expand Create a promotion code — response body — restrictions |
times_redeemed | JSON | Required within parent | |
times_redeemed (anyOf 1) | integer | Alternative | Number of times this promotion code has been used. |
times_redeemed (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Referenced models: Create a customer — response body, Delete a customer — response body, Create a promotion code — response body — promotion, Create a promotion code — response body — restrictions
Delete a customer — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
deleted | boolean | Required within parent | Always true for a deleted object Known values: True |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: customer |
Create a promotion code — response body — promotion
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
coupon | JSON | Optional | |
coupon (anyOf 1) | JSON | Alternative | If promotion `type` is `coupon`, the coupon for this promotion. |
coupon (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
coupon (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a coupon — response body |
coupon (anyOf 2) | null | Alternative | |
type | string | Required within parent | The type of promotion. Known values: coupon |
Referenced models: Create a coupon — response body
Create a promotion code — response body — restrictions
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
currency_options | object | Optional | Promotion code restrictions defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). Additional keys: see wildcard field |
currency_options.* | Model | Additional keys | Expand Create a promotion code — response body — restrictions currency options value |
first_time_transaction | boolean | Required within parent | A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices |
minimum_amount | JSON | Optional | |
minimum_amount (anyOf 1) | JSON | Alternative | |
minimum_amount (anyOf 1) (anyOf 1) | integer | Alternative | Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). |
minimum_amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
minimum_amount (anyOf 2) | null | Alternative | |
minimum_amount_currency | JSON | Optional | |
minimum_amount_currency (anyOf 1) | string | Alternative | Three-letter [ISO code](https://stripe.com/docs/currencies) for minimum_amount Maximum length: 5000 |
minimum_amount_currency (anyOf 2) | null | Alternative |
Referenced models: Create a promotion code — response body — restrictions currency options value
Create a Location — response body — address
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
city | JSON | Optional | |
city (anyOf 1) | string | Alternative | City, district, suburb, town, or village. Maximum length: 5000 |
city (anyOf 2) | null | Alternative | |
country | JSON | Optional | |
country (anyOf 1) | string | Alternative | Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). Maximum length: 5000 |
country (anyOf 2) | null | Alternative | |
line1 | JSON | Optional | |
line1 (anyOf 1) | string | Alternative | Address line 1, such as the street, PO Box, or company name. Maximum length: 5000 |
line1 (anyOf 2) | null | Alternative | |
line2 | JSON | Optional | |
line2 (anyOf 1) | string | Alternative | Address line 2, such as the apartment, suite, unit, or building. Maximum length: 5000 |
line2 (anyOf 2) | null | Alternative | |
postal_code | JSON | Optional | |
postal_code (anyOf 1) | string | Alternative | ZIP or postal code. Maximum length: 5000 |
postal_code (anyOf 2) | null | Alternative | |
state | JSON | Optional | |
state (anyOf 1) | string | Alternative | State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)). Maximum length: 5000 |
state (anyOf 2) | null | Alternative |
Create a promotion code — response body — restrictions currency options value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
minimum_amount | JSON | Required within parent | |
minimum_amount (anyOf 1) | integer | Alternative | Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). |
minimum_amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Create a Payment Method — response body — zip
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.getpromotioncodes. Catalog operation: GetPromotionCodes. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Stripe-Version": "2026-09-30.endive"}