Files
cfw-autumn/others/python-sdk/docs/sdks/referrals/README.md
John Yeo 90287e6308 latest
2026-02-19 13:24:33 +00:00

4.7 KiB
Raw Blame History

Referrals

Overview

Available Operations

  • create_code - Create or fetch a referral code for a customer in a referral program.
  • redeem_code - Redeem a referral code for a customer.

create_code

Create or fetch a referral code for a customer in a referral program.

Example Usage

from autumn_sdk import Autumn


with Autumn(
    x_api_version="2.1",
    secret_key="<YOUR_BEARER_TOKEN_HERE>",
) as autumn:

    res = autumn.referrals.create_code(customer_id="cus_123", program_id="prog_123")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
customer_id str ✔️ The unique identifier of the customer
program_id str ✔️ ID of your referral program
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.CreateReferralCodeResponse

Errors

Error Type Status Code Content Type
errors.AutumnDefaultError 4XX, 5XX */*

redeem_code

Redeem a referral code for a customer.

Example Usage

from autumn_sdk import Autumn


with Autumn(
    x_api_version="2.1",
    secret_key="<YOUR_BEARER_TOKEN_HERE>",
) as autumn:

    res = autumn.referrals.redeem_code(code="REF123", customer_id="cus_456")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
code str ✔️ The referral code to redeem
customer_id str ✔️ The unique identifier of the customer redeeming the code
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.RedeemReferralCodeResponse

Errors

Error Type Status Code Content Type
errors.AutumnDefaultError 4XX, 5XX */*