Documentation

GrantItemsToUsers

Adds the specified items to the specified user inventories

Request Details

This function directly adds inventory items to user 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.

GrantItemsToUsersRequest
Request Properties
CatalogVersion String

Catalog version from which items are to be granted.

ItemGrants (required) List<ItemGrant>

Array of items to grant and the users to whom the items are to be granted.

POST https://{{TitleID}}.playfabapi.com/Server/GrantItemsToUsers
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "CatalogVersion": "5",
  "ItemGrants": [
    {
      "PlayFabId": "20394883",
      "ItemId": "shield_level_1",
      "Annotation": "Entered Level 2"
    },
    {
      "PlayFabId": "20394883",
      "ItemId": "shield_level_2",
      "Annotation": "Entered Level 2",
      "Data": {
        "Equipped": "True",
        "Slot": "Head"
      }
    }
  ]
}
        

Response Details

Please note that the order of the items in the response may not match the order of items in the request.

GrantItemsToUsersResult
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_1",
        "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_2",
        "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,
        "CustomData": {
          "Equipped": "True",
          "Slot": "Head"
        }
      }
    ]
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
CatalogNotConfigured 1218