Skip to main content

Manage Player Profiles through the API

Create a Player Profile​

Using the following GraphQL mutation, it is possible to create a new Player Profile named Jeff
Requires the following permission: organization:players:create

mutation {
createPlayer(
input: {
username: "test"
profilePicUrl: "https://test.com/image.png"
description: "Test"
ownerId: "optional"
organizationCustomId: "optional"
customFields: [
{
value: "[email protected]",
property: "email",
}
]
}
) {
id
username
profilePicUrl
description
ownerId
organizationCustomId
}
}

Fields:

  • username: The username of the Player, it will be used to find the user through the searchPlayer endpoint
  • profilePicUrl: An URL to a profile picture, this field is optional
  • description: The description that will be shown on the Player Profile page
  • ownerId: Set the value of this field to the Account ID you want to link this Player Profile to. If you remove this field, the Profile will be set to Anonymous
  • organizationCustomId: This field is optional and is used to attach the Player Profile to an external ID
  • customFields: Custom fields are custom key-value set that you can attach to an account. They can be used through permissions to define advanced rules and through Tournament registration rules

Update a Player Profile​

Using the following GraphQL mutation, it is possible to update a Player Profile
Requires the following permission: organization:players:update

mutation {
updatePlayer(id: "playerId", customId: "organizationCustomId", input: {
description: "newDesc"
customFields: [{
property: "updateAField"
value: "updatedValue"
}]
profilePicUrl: "aNewProfilePicUrl"
username: "a new username for a cool person"
}) {
username
profilePicUrl
description
id
organizationCustomId
ownerId
}
}

Fields: Same as Create

Retrieve a Player Profile​

You can use two methods to retrieve users: Either through the player query, which will allow you to retrieve a player either through its id, organizationCustomId or ownerId.
The following query allows you to retrieve the user Requires the following permission: organization:players:view

query {
player(id: "playerId", ownerId: "or OwnerId", customId: "or organizationCustomId") {
username
ownerId
organizationCustomId
id
description
profilePicUrl
}
}

The following query allows you to retrieve a list of 20 Player Profiles through a search
The search system uses the first letters of the username to find the Player Profile. For example, using alex as an input will be able to find AlexMog and AlexLuke but not Mark
The search mechanism is not case-sensitive
Requires the following permission: organization:players:view

query {
searchPlayer(username: "anExampleUsername") {
username
ownerId
organizationCustomId
id
description
profilePicUrl
}
}