import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.referrals.updateProgram({
referralProgramId: "<id>",
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.referrals.update_program(
referral_program_id="<id>",
)curl --request POST \
--url https://api.useautumn.com/v1/referral_programs.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"referral_program_id": "<string>",
"reward_id": "<string>",
"max_redemptions": 4503599627370495,
"plan_ids": [
"<string>"
],
"exclude_trial": true
}
'{
"id": "refer_a_friend",
"reward_id": "beta_credits_grant",
"redeem_on": "customer_creation",
"received_by": "referrer",
"max_redemptions": 10,
"plan_ids": null,
"exclude_trial": false,
"created_at": 1718000000000
}
Update Referral Program
Update a referral program. Omitted fields keep their current value.
import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.referrals.updateProgram({
referralProgramId: "<id>",
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.referrals.update_program(
referral_program_id="<id>",
)curl --request POST \
--url https://api.useautumn.com/v1/referral_programs.update \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"referral_program_id": "<string>",
"reward_id": "<string>",
"max_redemptions": 4503599627370495,
"plan_ids": [
"<string>"
],
"exclude_trial": true
}
'{
"id": "refer_a_friend",
"reward_id": "beta_credits_grant",
"redeem_on": "customer_creation",
"received_by": "referrer",
"max_redemptions": 10,
"plan_ids": null,
"exclude_trial": false,
"created_at": 1718000000000
}
Body Parameters
Response
{
"id": "refer_a_friend",
"reward_id": "beta_credits_grant",
"redeem_on": "customer_creation",
"received_by": "referrer",
"max_redemptions": 10,
"plan_ids": null,
"exclude_trial": false,
"created_at": 1718000000000
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
The ID of the referral program.
1The ID of the reward granted when a code is redeemed.
1When the reward is granted: on redemption, or when the redeemer checks out.
customer_creation, checkout Who receives the reward: the referrer only, or both parties.
referrer, all A positive redemption limit. Omit to leave unchanged; null removes it.
0 < x <= 9007199254740991Required when redeem_on is checkout. Plan IDs must be unique. Omit to leave unchanged; null removes them.
1Omit to leave unchanged; null removes it.
Response
OK
The unique identifier for the referral program.
The ID of the reward granted when a code is redeemed.
When the reward is granted: on redemption, or when the redeemer checks out.
customer_creation, checkout Who receives the reward: the referrer only, or both parties.
referrer, all The Unix timestamp (in milliseconds) when the referral program was created.
The maximum number of times a referral code can be redeemed.
The plans whose checkout triggers the reward. Only used when redeem_on is checkout.
Whether checkouts that start a trial should skip granting the reward.