Generating codes for your program
This page covers generating codes automatically for your players, which the creator then claims to their own Nexus account. You can issue a code from inside your own product without requiring the creator to have a Nexus account first. Nexus cannot pay that creator until they register and link their account to the member you generated.
Generating a code
Section titled “Generating a code”POST to the /manage/members route with your internal id for a player (playerId).
If the playerId you send already belongs to a member, Nexus adds the generated code to that member’s existing Nexus account. Their member information flags the code isGenerated but not isManaged, because it is already associated with a Nexus account.
If no member matches that playerId, Nexus creates a new Support-a-Creator Nexus that you manage and adds it to your program. Once you link that playerId to an existing Nexus, the Nexus user has claimed the generated code and you no longer manage it. You can also send players to Nexus with an auth code for a Support-a-Creator Nexus you manage, which prompts them to register and claim the generated code. See Claiming a generated code for more details.
The Nexus Creator Dashboard does not show the generated code to the Nexus user. You can disclose it to them yourself at your discretion.
/manage/memberscurl -X 'POST' \ 'https://api.nexus.gg/v1/manage/members' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -H 'X-SHARED-SECRET: nexus_sk_your_key_here' \ -d '{ "playerId": "userUniqueIdentifier1", "playerMetadata": { "displayName": "Unique User 1" } }'The status should be 200 OK with a JSON response body that looks something like this:
{ "groupId": "CsRKC8uD0NLtyQ0LOt8Ru", "groupName": "Test Group", "playerId": "userUniqueIdentifier1", "playerMetadata": { "displayName": "Unique User 1" }, "code": "abcd123"}Linking to an existing Nexus
Section titled “Linking to an existing Nexus”To link an existing Nexus account to your program, use an Authentication Code that the user generates in the Nexus Dashboard.
/manage/members/linkcurl -X 'POST' \ 'https://api.nexus.gg/v1/manage/members/link' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -H 'X-SHARED-SECRET: nexus_sk_your_key_here' \ -d '{ "playerId": "userUniqueIdentifier1", "playerMetadata": { "displayName": "Unique User 1" }, "authCode": "035-536"}'The status should be 200 OK with a JSON response body that looks something like this:
{ "groupId": "CsRKC8uD0NLtyQ0LOt8Ru", "groupName": "Test Group", "playerId": "userUniqueIdentifier1", "playerMetadata": { "displayName": "Unique User 1" }, "codes": [ { "code": "samzorz", "isPrimary": true, "isGenerated": false, "isManaged": false }, { "code": "abcd123", "isPrimary": false, "isGenerated": true, "isManaged": false } ]}If you previously generated a code for this player, their code list includes it too. That code stays flagged isGenerated, but you no longer manage it.
After the link succeeds, you can retrieve this member’s details for your group using that playerId as the reference.