POST
/
api
/
referral
/
codes
import SnagSolutions from '@snagsolutions/sdk';

const client = new SnagSolutions({
  apiKey: process.env['X_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const response = await client.referral.createCode({
    loyaltyRuleId: '558bcf56-24f1-4ef4-9787-043086295780',
  });

  console.log(response.id);
}

main();
{
  "id": "<string>",
  "websiteId": "<string>",
  "organizationId": "<string>",
  "referralCode": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "deletedAt": "2023-11-07T05:31:56Z",
  "userId": "<string>"
}

Authorizations

X-API-KEY
string
header
required

Body

application/json
Body
loyaltyRuleId
string
required
Example:

"558bcf56-24f1-4ef4-9787-043086295780"

userId
string

Response

200
application/json
200
id
string
required
websiteId
string
required
organizationId
string
required
referralCode
string
required
createdAt
string
required
updatedAt
string
required
deletedAt
string | null
required
userId
string
required