Skip to main content
POST
/
v1
/
referrals.create_code
Typescript (SDK)
import { Autumn } from 'autumn-js'

const autumn = new Autumn()

const result = await autumn.referrals.createCode({
  customerId: "cus_123",
  programId: "prog_123",
});
{
  "code": "<string>",
  "customer_id": "<string>",
  "created_at": 123
}

Body Parameters

Response

{
  "code": "<string>",
  "customer_id": "<string>",
  "created_at": 123
}

Authorizations

Authorization
string
header
required

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

Headers

x-api-version
string
default:2.1
required

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

OK

code
string
required

The referral code that can be shared with customers

customer_id
string
required

Your unique identifier for the customer

created_at
number
required

The timestamp of when the referral code was created