Skip to content
EntitlerDocs

POST/v1/customers/{external_id}/referral-codes

Get a customer's referral code

Returns the customer's code for a referral offer, creating it on the first ask, with an optional code the business chooses. Needs customers:write or billing:self.

curl -X POST 'https://api.entitler.co/v1/customers/ada/referral-codes' \
  -H "Authorization: Bearer $ENTITLER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"code","offerKey":"offerKey","target":{"environmentId":"environmentId","projectId":"projectId","teamId":"teamId"}}'

Credentials

Send any one of these:

  • Bearer token

Path parameters

NameTypeDescription
external_idrequiredstringThe customer's external ID, or me for the customer a customer token or identity token names.

Request body

object

  • codestring
  • offerKeystring
  • targetProductTarget
    • environmentIdstring
    • projectIdstring
    • teamIdstring

Responses

200The GetReferralCodeResponse message.

GetReferralCodeResponse

  • createdbooleanrequired
  • referralCodeReferralCode
    • codestringrequired
    • createdAtintegerrequired

      at least 0; at most 18446744073709552000

    • idstringrequired
    • maxUsesinteger (int64)required

      at least 0; at most 4294967295

    • offerIdstringrequired
    • offerKeystringrequired
    • usesintegerrequired

      at least 0; at most 18446744073709552000

ErrorA refusal, with the HTTP status of its gRPC code.

Error

  • errorobjectrequired
    • codestringrequired
    • parametersobjectrequired

      Each value: string

    • reasonstringor nullrequired