Documentation

GrantItemsToCharacter

Adds the specified items to the specified character's inventory

Request Details

This function directly adds inventory items to the character's inventories. As a result of this operations, the user will not be charged any transaction fee, regardless of the inventory item catalog definition. Please note that the processing time for inventory grants and purchases increases fractionally the more items are in the inventory, and the more items are in the grant/purchase operation.

GrantItemsToCharacterRequest
Request Properties
Annotation String

String detailing any additional information concerning this operation.

CatalogVersion String

Catalog version from which items are to be granted.

CharacterId (required) String

Unique PlayFab assigned ID for a specific character owned by a user

ItemIds List<String>

Array of itemIds to grant to the user.

PlayFabId (required) String

Unique PlayFab assigned ID of the user on whom the operation will be performed.

POST https://{{TitleID}}.playfabapi.com/Server/GrantItemsToCharacter
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "CharacterId": "9876543268",
  "PlayFabId": "20394883",
  "Annotation": "Entered Level 2",
  "ItemIds": [
    "shield_level_5",
    "shield_level_6"
  ]
}
        

Response Details

GrantItemsToCharacterResult
Result Properties
ItemGrantResults List<GrantedItemInstance>

Array of items granted to users.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "ItemGrantResults": [
      {
        "PlayFabId": "20394883",
        "Result": true,
        "ItemId": "shield_level_5",
        "ItemInstanceId": "133713371337",
        "ItemClass": "shields",
        "PurchaseDate": "2017-03-07T00:00:00Z",
        "Expiration": "2018-10-01T00:00:00Z",
        "RemainingUses": 10,
        "Annotation": "Entered Level 2",
        "CatalogVersion": "5",
        "BundleParent": "crate block 1",
        "UnitPrice": 0
      },
      {
        "PlayFabId": "20394883",
        "Result": true,
        "ItemId": "shield_level_6",
        "ItemInstanceId": "133713371337",
        "ItemClass": "shields",
        "PurchaseDate": "2017-03-07T00:00:00Z",
        "Expiration": "2018-10-01T00:00:00Z",
        "RemainingUses": 10,
        "Annotation": "Entered Level 2",
        "CatalogVersion": "5",
        "BundleParent": "crate block 1",
        "UnitPrice": 0
      }
    ]
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
AccountNotFound 1001
CatalogNotConfigured 1218
CharacterNotFound 1135