Skip to main content
POST
/
referrals
/
code
Get a referral code
curl --request POST \
  --url https://api.useautumn.com/v1/referrals/code \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "customer_id": "<string>",
  "program_id": "<string>"
}'
{
  "code": "<string>",
  "customer_id": "<string>",
  "created_at": 123
}
This endpoint creates or retrieves a unique referral code for a customer within a specific referral program.
A referral code is unique per customer within each program. On the first call, a new code is created, but subsequent calls will return the same existing code for that customer and program combination.
The program_id parameter refers to the referral program ID that you define when creating a referral program in the Autumn dashboard. Each program can have different rewards and rules.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
customer_id
string
required

The unique identifier of the customer

program_id
string
required

ID of your referral program

Response

200 - application/json

Referral code generated successfully

code
string

The referral code that can be shared with customers

customer_id
string

Your unique identifier for the customer

created_at
integer

The timestamp of when the referral code was created

I