Player Item Management - Grant Items To Users

NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2. Adds the specified items to the specified user inventories

POST https://titleId.playfabapi.com/Admin/GrantItemsToUsers

Request Header

Name Required Type Description
X-SecretKey True

string

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Request Body

Name Required Type Description
ItemGrants True

ItemGrant[]

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

CatalogVersion

string

Catalog version from which items are to be granted.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Responses

Name Type Description
200 OK

GrantItemsToUsersResult

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

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

GrantedItemInstance

Result of granting an item to a user. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

GrantItemsToUsersRequest

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.

GrantItemsToUsersResult

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

ItemGrant

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

GrantedItemInstance

Result of granting an item to a user. Note, to retrieve additional information for an item such as Tags, Description that are the same across all instances of the item, a call to GetCatalogItems is required. The ItemID of can be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set when the User's specific instance has updated the CustomData via a call to UpdateUserInventoryItemCustomData. Other fields such as UnitPrice and UnitCurrency are only set when the item was granted via a purchase.

Name Type Description
Annotation

string

Game specific comment associated with this instance when it was added to the user inventory.

BundleContents

string[]

Array of unique items that were awarded when this catalog item was purchased.

BundleParent

string

Unique identifier for the parent inventory item, as defined in the catalog, for object which were added from a bundle or container.

CatalogVersion

string

Catalog version for the inventory item, when this instance was created.

CharacterId

string

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

CustomData

object

A set of custom key-value pairs on the instance of the inventory item, which is not to be confused with the catalog item's custom data.

DisplayName

string

CatalogItem.DisplayName at the time this item was purchased.

Expiration

string

Timestamp for when this instance will expire.

ItemClass

string

Class name for the inventory item, as defined in the catalog.

ItemId

string

Unique identifier for the inventory item, as defined in the catalog.

ItemInstanceId

string

Unique item identifier for this specific instance of the item.

PlayFabId

string

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

PurchaseDate

string

Timestamp for when this instance was purchased.

RemainingUses

number

Total number of remaining uses, if this is a consumable item.

Result

boolean

Result of this operation.

UnitCurrency

string

Currency type for the cost of the catalog item. Not available when granting items.

UnitPrice

number

Cost of the catalog item in the given currency. Not available when granting items.

UsesIncrementedBy

number

The number of uses that were added or removed to this item in this call.

GrantItemsToUsersRequest

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.

Name Type Description
CatalogVersion

string

Catalog version from which items are to be granted.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

ItemGrants

ItemGrant[]

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

GrantItemsToUsersResult

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

Name Type Description
ItemGrantResults

GrantedItemInstance[]

Array of items granted to users.

ItemGrant

Name Type Description
Annotation

string

String detailing any additional information concerning this operation.

CharacterId

string

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

Data

object

Key-value pairs to be written to the custom data. Note that keys are trimmed of whitespace, are limited in size, and may not begin with a '!' character or be null.

ItemId

string

Unique identifier of the catalog item to be granted to the user.

KeysToRemove

string[]

Optional list of Data-keys to remove from UserData. Some SDKs cannot insert null-values into Data due to language constraints. Use this to delete the keys directly.

PlayFabId

string

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

Error Codes

Name Code
AccountNotFound 1001
CatalogNotConfigured 1218