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
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters”Example
V1StGXR8_Z5jdHi6B1LiOCreator 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
Section titled “Request Body”object
Unique id of the player that the event pertains to
Example
player_8f2c41d0Code for the creator that referred this user
Example
popcornfrogResponses
Section titled “ Responses ”Events successfully updated with the new referral code
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.
object
CodeNotInGroup: Creator group is private, and specified code is not linked to it
InvalidGroup: No creator group was found with the specified groupId
InvalidAuthCode: AuthCode provided is not valid
ExpiredAuthCode: AuchCode provided has expired
ReferralNexusNotFound: No Nexus was found to match the provided referral code
BountyNotFound: No bounty was found with the specified bountyId
CreatorNotFound: No creator found with the specified creatorId
InvalidEventCode: No event found with the specifed event code
const url = 'https://api.nexus.gg/v1/bounties/event/add-referral-code?groupId=V1StGXR8_Z5jdHi6B1LiO';const options = { method: 'POST', headers: { 'X-SHARED-SECRET': 'nexus_sk_your_key_here', 'Content-Type': 'application-x-www-form-urlencoded' }, body: '{ "playerId": "player_8f2c41d0", "referralCode": "popcornfrog" }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://api.nexus.gg/v1/bounties/event/add-referral-code?groupId=V1StGXR8_Z5jdHi6B1LiO' \ --header 'Content-Type: application-x-www-form-urlencoded' \ --header 'X-SHARED-SECRET: nexus_sk_your_key_here' \ --data '{ "playerId": "player_8f2c41d0", "referralCode": "popcornfrog" }'Example
{ "code": "InvalidGroup", "message": "Bounty Not found"}