> ## Documentation Index
> Fetch the complete documentation index at: https://docs.useautumn.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Rewards

> List the coupons and feature grants configured for the org.

export const DynamicResponseExample = ({json, statusCode = "200"}) => {
  const toCamelCase = str => {
    return str.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
  };
  const convertKeysToCamelCase = obj => {
    if (Array.isArray(obj)) {
      return obj.map(item => convertKeysToCamelCase(item));
    }
    if (obj !== null && typeof obj === "object") {
      return Object.keys(obj).reduce((acc, key) => {
        const camelKey = toCamelCase(key);
        acc[camelKey] = convertKeysToCamelCase(obj[key]);
        return acc;
      }, {});
    }
    return obj;
  };
  const [isTypeScript, setIsTypeScript] = useState(() => {
    if (typeof window !== "undefined") {
      try {
        const lang = localStorage.getItem("code");
        return JSON.parse(lang) === "typescript";
      } catch {
        return true;
      }
    }
    return true;
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      if (event.detail?.key === "code") {
        try {
          const value = JSON.parse(event.detail.value);
          setIsTypeScript(value === "typescript");
        } catch {}
      }
    };
    const pollInterval = setInterval(() => {
      try {
        const lang = localStorage.getItem("code");
        const value = JSON.parse(lang);
        setIsTypeScript(value === "typescript");
      } catch {}
    }, 300);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, []);
  const camelCaseJson = useMemo(() => convertKeysToCamelCase(json), [json]);
  const snakeCaseString = JSON.stringify(json, null, 2);
  const camelCaseString = JSON.stringify(camelCaseJson, null, 2);
  return <ResponseExample>
			{isTypeScript ? <CodeBlock language="json" filename={statusCode}>
					{camelCaseString}
				</CodeBlock> : <CodeBlock language="json" filename={statusCode}>
					{snakeCaseString}
				</CodeBlock>}
		</ResponseExample>;
};

export const DynamicResponseField = ({children, name, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedName = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(name) : name;
    } catch {
      return name;
    }
  }, [name, lang]);
  return <ResponseField name={resolvedName} {...props}>
			{children}
		</ResponseField>;
};

export const DynamicParamField = ({children, body, path, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedBody = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(body) : body;
    } catch {
      return body;
    }
  }, [body, lang]);
  const resolvedPath = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(path) : path;
    } catch {
      return path;
    }
  }, [path, lang]);
  return <ParamField body={resolvedBody} path={resolvedPath} {...props}>
			{children}
		</ParamField>;
};

### Response

<DynamicResponseField name="coupons" type="object[]">
  The list of coupons configured for the organization.

  <Expandable title="properties">
    <DynamicResponseField name="id" type="string">
      The unique identifier for the coupon.
    </DynamicResponseField>

    <DynamicResponseField name="name" type="string | null">
      A human-readable name for the coupon.
    </DynamicResponseField>

    <DynamicResponseField name="type" type="'percentage_discount' | 'fixed_discount' | 'invoice_credits'">
      The type of discount: percentage\_discount, fixed\_discount, or invoice\_credits.
    </DynamicResponseField>

    <DynamicResponseField name="value" type="number">
      The discount value. A percentage for percentage\_discount, or an amount for fixed\_discount / invoice\_credits.
    </DynamicResponseField>

    <DynamicResponseField name="duration" type="object">
      How long the coupon applies once redeemed.

      <Expandable title="properties">
        <DynamicResponseField name="type" type="'one_off' | 'months' | 'forever'">
          The unit of time the duration is measured in.
        </DynamicResponseField>

        <DynamicResponseField name="length" type="number | null">
          The number of `type` periods the duration lasts, or null when the type has no length (e.g. one\_off, forever).
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="plan_ids" type="string[] | null">
      The plan IDs the coupon applies to, or null when it applies to all plans.
    </DynamicResponseField>

    <DynamicResponseField name="promo_codes" type="object[]">
      The promo codes customers can use to redeem the coupon.

      <Expandable title="properties">
        <DynamicResponseField name="code" type="string">
          The promo code customers enter to redeem the coupon.
        </DynamicResponseField>

        <DynamicResponseField name="global_max_redemption" type="number | null">
          Maximum number of times this promo code can be redeemed across all customers, or null for unlimited.
        </DynamicResponseField>

        <DynamicResponseField name="first_time_transaction" type="boolean | null">
          Whether this promo code can only be applied to a customer's first transaction.
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="created_at" type="number">
      The Unix timestamp (in milliseconds) when the coupon was created.
    </DynamicResponseField>
  </Expandable>
</DynamicResponseField>

<DynamicResponseField name="feature_grants" type="object[]">
  The list of feature grants configured for the organization.

  <Expandable title="properties">
    <DynamicResponseField name="id" type="string">
      The unique identifier for the feature grant.
    </DynamicResponseField>

    <DynamicResponseField name="name" type="string | null">
      A human-readable name for the feature grant.
    </DynamicResponseField>

    <DynamicResponseField name="grants" type="object[]">
      The feature grants awarded when the grant is redeemed.

      <Expandable title="properties">
        <DynamicResponseField name="feature_id" type="string">
          The feature ID this grant applies to.
        </DynamicResponseField>

        <DynamicResponseField name="included" type="number | null">
          The amount of the feature granted, or null for boolean features.
        </DynamicResponseField>

        <DynamicResponseField name="expiry" type="object | null">
          How long the granted amount lasts before expiring, or null for a permanent grant.

          <Expandable title="properties">
            <DynamicResponseField name="type" type="'day' | 'week' | 'month' | 'year'">
              The unit of time the duration is measured in.
            </DynamicResponseField>

            <DynamicResponseField name="length" type="number | null">
              The number of `type` periods the duration lasts, or null when the type has no length (e.g. one\_off, forever).
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="promo_codes" type="object[]">
      The promo codes customers can use to redeem the feature grant.

      <Expandable title="properties">
        <DynamicResponseField name="code" type="string">
          The promo code customers enter to redeem the feature grant.
        </DynamicResponseField>

        <DynamicResponseField name="max_uses" type="number | null">
          Maximum number of times this promo code can be redeemed, or null for unlimited.
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="created_at" type="number">
      The Unix timestamp (in milliseconds) when the feature grant was created.
    </DynamicResponseField>
  </Expandable>
</DynamicResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "coupons": [],
    "feature_grants": []
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi POST /v1/rewards.list
openapi: 3.1.0
info:
  title: Autumn API
  version: 2.3.0
servers:
  - url: https://api.useautumn.com
    description: Production server
security:
  - secretKey: []
paths:
  /v1/rewards.list:
    post:
      tags:
        - rewards
      description: List the coupons and feature grants configured for the org.
      operationId: listRewards
      parameters:
        - name: x-api-version
          in: header
          required: true
          schema:
            type: string
            default: 2.3.0
          x-speakeasy-globals-hidden: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              title: RewardsListParams
              examples:
                - {}
            example: {}
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  coupons:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The unique identifier for the coupon.
                        name:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: A human-readable name for the coupon.
                        type:
                          enum:
                            - percentage_discount
                            - fixed_discount
                            - invoice_credits
                          type: string
                          description: >-
                            The type of discount: percentage_discount,
                            fixed_discount, or invoice_credits.
                        value:
                          type: number
                          description: >-
                            The discount value. A percentage for
                            percentage_discount, or an amount for fixed_discount
                            / invoice_credits.
                        duration:
                          type: object
                          properties:
                            type:
                              enum:
                                - one_off
                                - months
                                - forever
                              type: string
                              description: The unit of time the duration is measured in.
                            length:
                              anyOf:
                                - type: number
                                - type: 'null'
                              description: >-
                                The number of `type` periods the duration lasts,
                                or null when the type has no length (e.g.
                                one_off, forever).
                          required:
                            - type
                            - length
                          description: How long the coupon applies once redeemed.
                        plan_ids:
                          anyOf:
                            - type: array
                              items:
                                type: string
                            - type: 'null'
                          description: >-
                            The plan IDs the coupon applies to, or null when it
                            applies to all plans.
                        promo_codes:
                          type: array
                          items:
                            type: object
                            properties:
                              code:
                                type: string
                                description: >-
                                  The promo code customers enter to redeem the
                                  coupon.
                              global_max_redemption:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                                description: >-
                                  Maximum number of times this promo code can be
                                  redeemed across all customers, or null for
                                  unlimited.
                              first_time_transaction:
                                anyOf:
                                  - type: boolean
                                  - type: 'null'
                                description: >-
                                  Whether this promo code can only be applied to
                                  a customer's first transaction.
                            required:
                              - code
                          description: >-
                            The promo codes customers can use to redeem the
                            coupon.
                        created_at:
                          type: number
                          description: >-
                            The Unix timestamp (in milliseconds) when the coupon
                            was created.
                      required:
                        - id
                        - type
                        - value
                        - duration
                        - plan_ids
                        - promo_codes
                        - created_at
                      examples:
                        - id: summer_sale
                          name: Summer Sale
                          type: percentage_discount
                          value: 20
                          duration:
                            type: months
                            length: 3
                          plan_ids:
                            - pro
                            - starter
                          promo_codes:
                            - code: SUMMER20
                              global_max_redemption: 100
                              first_time_transaction: false
                          created_at: 1718000000000
                    description: The list of coupons configured for the organization.
                  feature_grants:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: The unique identifier for the feature grant.
                        name:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: A human-readable name for the feature grant.
                        grants:
                          type: array
                          items:
                            type: object
                            properties:
                              feature_id:
                                type: string
                                description: The feature ID this grant applies to.
                              included:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                                description: >-
                                  The amount of the feature granted, or null for
                                  boolean features.
                              expiry:
                                anyOf:
                                  - type: object
                                    properties:
                                      type:
                                        enum:
                                          - day
                                          - week
                                          - month
                                          - year
                                        type: string
                                        description: >-
                                          The unit of time the duration is
                                          measured in.
                                      length:
                                        anyOf:
                                          - type: number
                                          - type: 'null'
                                        description: >-
                                          The number of `type` periods the
                                          duration lasts, or null when the type
                                          has no length (e.g. one_off, forever).
                                    required:
                                      - type
                                      - length
                                  - type: 'null'
                                description: >-
                                  How long the granted amount lasts before
                                  expiring, or null for a permanent grant.
                            required:
                              - feature_id
                              - included
                              - expiry
                          description: >-
                            The feature grants awarded when the grant is
                            redeemed.
                        promo_codes:
                          type: array
                          items:
                            type: object
                            properties:
                              code:
                                type: string
                                description: >-
                                  The promo code customers enter to redeem the
                                  feature grant.
                              max_uses:
                                anyOf:
                                  - type: number
                                  - type: 'null'
                                description: >-
                                  Maximum number of times this promo code can be
                                  redeemed, or null for unlimited.
                            required:
                              - code
                              - max_uses
                          description: >-
                            The promo codes customers can use to redeem the
                            feature grant.
                        created_at:
                          type: number
                          description: >-
                            The Unix timestamp (in milliseconds) when the
                            feature grant was created.
                      required:
                        - id
                        - grants
                        - promo_codes
                        - created_at
                      examples:
                        - id: beta_credits_grant
                          name: Beta Tester Credits
                          promo_codes:
                            - code: BETA2024
                              max_uses: 500
                          grants:
                            - feature_id: credits
                              included: 1000
                              expiry:
                                type: month
                                length: 1
                          created_at: 1718000000000
                    description: >-
                      The list of feature grants configured for the
                      organization.
                required:
                  - coupons
                  - feature_grants
                examples:
                  - coupons: []
                    feature_grants: []
              example:
                coupons: []
                feature_grants: []
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Autumn } from 'autumn-js'

            const autumn = new Autumn()

            const result = await autumn.rewards.list({});
        - lang: python
          label: Python (SDK)
          source: |-
            from autumn_sdk import Autumn

            autumn = Autumn(secret_key="am_sk_test...")

            res = autumn.rewards.list(
                request={},
            )
components:
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````