Documentation

GrantCharacterToUser

Grants the specified character type to the user. CharacterIds are not globally unique; characterId must be evaluated with the parent PlayFabId to guarantee uniqueness.

Request Details

Grants a character to the user of the type specified by the item ID. The user must already have an instance of this item in their inventory in order to allow character creation. This item can come from a purchase or grant, which must be done before calling to create the character.

GrantCharacterToUserRequest
Request Properties
CatalogVersion String

Catalog version from which items are to be granted.

CharacterName (required) String

Non-unique display name of the character being granted (1-20 characters in length).

ItemId (required) String

Catalog item identifier of the item in the user's inventory that corresponds to the character in the catalog to be created.

POST https://{{TitleID}}.playfabapi.com/Client/GrantCharacterToUser
    Content-Type: application/json
    X-Authentication: <user_session_ticket_value>
{
  "CatalogVersion": "2.2",
  "ItemId": "Blue Warrior",
  "CharacterName": "FighterDude"
}
        

Response Details

GrantCharacterToUserResult
Result Properties
CharacterId String

Unique identifier tagged to this character.

CharacterType String

Type of character that was created.

Result (required) Boolean

Indicates whether this character was created successfully.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "CharacterId": "98765432",
    "CharacterType": "Blue Warrior",
    "Result": true
  }
}

Authentication

SessionTicket

Possible Error Codes

Name Code
InternalServerError 1110
InvalidItemProperties 1091
ItemNotOwned 1048