# Add referral code

`POST https://api.nexus.gg/v1/bounties/event/add-referral-code`

Backfills a referral code onto a player's past events that don't already have one. Only events for this `playerId` where `referralCode` is still null are updated; events that already carry a code are left alone. `referralCode` must resolve to an approved member of the group, and for a Private program it must also be linked to the group. A request that fails schema validation (a missing `playerId` or `referralCode`) returns a `{status: 400, errors: [...]}` body.

## Authorizations

- `X-SHARED-SECRET` (string, header, required)

## Query parameters

- `groupId` (string) - Creator group to use for this operation. If your key is scoped to a single program, that group is always used regardless of this value; otherwise falls back to your default group when omitted.

## Request body (`application-x-www-form-urlencoded`)

- `playerId` (string, required) - Unique id of the player that the event pertains to
- `referralCode` (string, required) - Code for the creator that referred this user

## Responses

### 200

Events successfully updated with the new referral code

### 400

Returned when `groupId` does not match a creator group on your publisher account, or `referralCode` does not resolve to an approved member of the group. Branch on `code`, not on `message`.

#### Body (`application/json`)

- `code` (string) - CodeNotInGroup: Creator group is private, and specified code is not linked to it<br/> InvalidGroup: No creator group was found with the specified groupId<br/> InvalidAuthCode: AuthCode provided is not valid<br/> ExpiredAuthCode: AuchCode provided has expired<br/> ReferralNexusNotFound: No Nexus was found to match the provided referral code<br/> BountyNotFound: No bounty was found with the specified bountyId<br/> CreatorNotFound: No creator found with the specified creatorId<br/> InvalidEventCode: No event found with the specifed event code Allowed values: InvalidGroup, CodeNotInGroup, InvalidAuthCode, ExpiredAuthCode, ReferralNexusNotFound, BountyNotFound, MemberNotFound, InvalidEventCode, UnknownError.
- `message` (string)
